PHPMailer安裝方法及簡單實例
Jun 13, 2016 pm 12:25 PM
打開你電腦里的PHP.INI文件,找到如下位置,添加紅線部分的內(nèi)容,路徑就是你PHPMailer存放的位置:
保存,重啟apache.
然后借用readme里的一個例子,稍微改一下就可以用了,由于只做最簡單的測試,很多東西我注釋掉了。
send.php
復制代碼 代碼如下:
require("class.phpmailer.php");
$mail = new PHPMailer();
$address = $_POST['address'];
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.songzi.org"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "phpmailer@songzi.org"; // SMTP username
$mail->Password = "******"; // SMTP password
$mail->From = "phpmailer@songzi.org";
$mail->FromName = "songzi";
$mail->AddAddress("$address", "");
//$mail->AddAddress(""); // name is optional
//$mail->AddReplyTo("", "");
//$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
//$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "PHPMailer測試郵件";
$mail->Body = "Hello,這是松子的測試郵件";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent.
";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
test.php?
復制代碼 代碼如下:
phpmailer Unit Test
請你輸入收信的郵箱地址:

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The reliable and safe currency spot trading platforms in 2025 include: 1. Binance, rich trading pairs, low fees, and advanced trading functions; 2. HTX Huobi, multiple trading pairs, low transaction fees, and friendly user interface; 3. OKX, multiple trading pairs, low transaction fees, and multiple trading tools; 4. Coinbase; 5. Kraken...

Entering CSGO HD blockbuster mode requires four steps: 1. Update the game client to the latest version; 2. Adjust the video settings to the highest parameters; 3. Start the game and enter high-definition mode; 4. Optimize performance and test adjustments. Through these steps, you can improve the gaming experience of CSGO and enjoy a clearer picture and a more immersive gaming environment.

Here are the top 10 well-known memory stick brands on the market: Samsung: Excellent performance and stability Kingston: Durability and reliability Zhiqi: High speed and overclocking capabilities Corsair: High performance, cooling and aesthetics Inruida: High cost performance and reliability Viagra: Wide product line Shadow: Performance and appearance for gamers Avatar: High cost performance Kintech: Innovative design and RGB lighting Bainaohui: Low price and reliable performance

The reliable and safe currency spot trading platforms in 2025 include: 1. Binance, rich trading pairs, low fees, and advanced trading functions; 2. HTX Huobi, multiple trading pairs, low transaction fees, and friendly user interface; 3. OKX, multiple trading pairs, low transaction fees, and multiple trading tools; 4. Coinbase; 5. Kraken...

Official download guide for Ouyi Exchange app: Android users can download it through the Google Play Store, and iOS users can download it through the Apple App Store. Visit the official website www.ouyiex.com to register and log in. Both the application and the official website provide rich transaction and management functions.

To solve the problem that the app cannot be installed after the iOS system is updated, you can use the following steps: 1. Clean the system cache: Go to "Settings" > "General" > "IPhone Storage", uninstall infrequently used apps and restart the device. 2. Solve through downgrade: Download the previous version of iOS firmware and use iTunes or Finder to downgrade. 3. Contact Apple customer service: provide serial number, seek professional help and backup data.

If the iPhone cannot be turned on, you can solve the following methods: 1. Forced restart: For iPhone 8 and later models, quickly press and release the volume up key, then quickly press and release the volume down key, and finally press and hold the side button until you see the Apple logo. 2. Check the battery level: Connect the phone to the charger for at least 15 minutes, and then try to turn it on. 3. Contact Apple customer service or go to Apple's authorized service center for repairs. 4. Use recovery mode: Connect your computer, use iTunes or Finder, press and hold the side button until the logo connected to iTunes appears, and select "Recover". 5. Check for physical damage: Check for cracks, depressions or other damage to the phone. If so, it is recommended to go to the maintenance center for treatment as soon as possible.

Binance, as the world's leading cryptocurrency trading platform, has attracted the favor of millions of users around the world with its powerful trading functions, rich digital asset types and excellent security performance. To meet the needs of different users, Binance provides a variety of access methods, including Android mobile apps and web versions.
