PHP implements sending emails (4)
In the previous article "PHP Implementation of Sending Emails (3)", we gave you a brief introduction to the method library through PHPMailer To achieve the functional effect of sending emails. Next, we will continue to explain how to implement the specific function of sending emails through PHPMailer based on the content of the previous article.
email.php code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
PHPMailer method library download address: http://www.php.cn/ xiazai/learn/5627
In the above codesendMail method, after introducing PHPMailerAutoload.php and instantiating PHPMailer, Related function methods can be called.
$mail->isSMTP() means using SMTP service;
$mail->SMTPAuth sets whether to use authentication ( Must be true);
$mail->HostSet the sender’s SMTP server address;
##$mail-> ;UsernameSet the sender's qq mailbox username;
$mail->Password Set the sender's mailbox password. Note that when using qq mailbox, fill in the "authorization password" "Instead of the email login password! (For the method of obtaining the qq authorization code, please refer to the article "PHP Implementation of Sending Mail (1)")
$mail->setFrom() is used to set the sender Information, such as the sender in the email format description, will be displayed here as send_user_name (xxxx@qq.com), and send_user_name is displayed as the name.
$mail->addAddress() Used to set the recipient’s email address.
$mail->Subject Set the email title;
$mail->Body Set the email body.
The above is the detailed content of PHP implements sending emails (4). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

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

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

Undress AI Tool
Undress images for free

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



