Phpmailer is a PHP function package used to send emails through SMTP.
Its functions include:
* 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
Usage
Require ("class. phpmailer. php "); // This is an smtp php document. you can download $ mail = new PHPMailer () online (); // Create a mail sending class $ mail-> CharSet = "UTF-8"; $ address = "sdasdsadsa@qq.com"; $ mail-> IsSMTP (); // use SMTP to send $ mail-> Host = "smtp.126.com"; // your enterprise Post Office domain name $ mail-> SMTPAuth = true; // enable SMTP Authentication $ mail-> Username = "sffsdf@126.com"; // Post Office Username (enter the complete email address) $ mail-> Password = "123444 "; // Post Office password $ mail-> Port = 25; $ mail-> From = "sffsdf@126.com"; // mail Recipient email address $ mail-> FromName = "online Q & a"; $ mail-> AddAddress ("$ address", "a"); // recipient address, you can replace it with any email address in the format of AddAddress ("recipient email", "recipient name") // $ mail-> AddReplyTo ("",""); // $ mail-> AddAttachment ("/var/tmp/file.tar.gz"); // add an attachment $ mail-> IsHTML (true ); // set email format to HTML // whether to use the HTML format $ mail-> Subject = "online Q & "; // email Title $ mail-> Body = "Welcome to the online Q chat website"; // the email content. If HTML is set above, it can be HTMLif (! $ Mail-> Send () {echo "failed to Send the email."; Echo" error cause: ". $ mail-> ErrorInfo; exit ;}