Phpmailer is a PHP function package used to send emails. It provides the following functions:
* Specify multiple recipients, cc addresses, hidden addresses, and reply addresses when sending mail.
* Multiple email codes are supported, including 8bit, base64, binary, and quoted-printable.
*. Supports SMTP authentication.
*. Support for redundant SMTP servers
*. Supports attachments and HTML-format emails.
*. Customize the mail header
* Images can be embedded in emails.
* Flexible debugging
*. Compatible SMTP servers include sendmail, Qmail, Postfix, IMail, and exchange.
*. Can run on any platform
The following is an example of my phpmailer test. The SMTP server of Sina is used. Before using it, you must apply for an email address from Sina and activate SMTP/POP3 in the settings. This example also demonstrates the transmission of different simplified and complex internal codes and attachments.
<? PHP Require_once 'Des/phpmailer/class. phpmailer. php' ; $ Mail =New Phpmailer (); $ Mail -> Charset = "UTF-8" ; $ Mail -> Issmtp (); $ Mail -> Smtpauth = True ; $ Mail -> Host = "smtp.sina.com" ; $ Mail -> Username = "amonest" ; $ Mail -> Password = "XXXXX"; $ Mail -> Setfrom ('amonest @ Sina.com ', 'amonest' ); $ Mail -> Addaddress ('amonest @ Sina.com ', 'amonest' ); $ Mail -> Subject = 'test mail' ; $ Mail -> Msghtml ('<B> hello, simplified, traditional ?!! </B>' ); $ Mail -> Addattachment ("license.txt" ); If (! $ Mail -> Send ()){ Echo "Mailer error :". $ Mail -> Errorinfo ;} Else { Echo "Message sent! Congratulations, the email is sent successfully! " ;}