PHPmailer email sending. You want to send a PHP mailer email.
First, download the class library phpmailer. because smtp.163.php is loaded, the sender's email address must use the 163 email address, its inbox, and other similar libraries. my Attachment. XLS is the attachment you want to add, which can be of any type.
Echo"
";
Require_once ('class. phpmailer. php ');
$ Mail = new PHPMailer (); // instantiate
$ Mail-> IsSMTP (); // enable SMTP
$ Mail-> Host = "smtp.163.com"; // The SMTP server uses the 163 email address as an example.
$ Mail-> Port = 25; // mail sending Port
$ Mail-> SMTPAuth = true; // enable SMTP Authentication
$ Mail-> CharSet = "UTF-8"; // character set
$ Mail-> Encoding = "base64"; // Encoding method
$ Mail-> Username = "yourmail@163.com"; // your mailbox 163
$ Mail-> Password = "password"; // your Password
$ Mail-> Subject = "Hello"; // any email title
$ Mail-> From = "youradmin@163.com"; // sender address (that is, your mailbox)
$ Mail-> FromName = "name"; // any sender name
$ Address = "$ _ POST ['email ']"; // the recipient's email is from post. this is the recipient's email.
$ Mail-> AddAddress ($ address, ""); // add a recipient (address, nickname)
$ Mail-> addattachment('xx.xls', 'My attachment .xls '); // add the attachment and specify the name
$ Mail-> IsHTML (true); // html content is supported
$ Mail-> AddEmbeddedImage ("logo.jpg", "my-attach", "logo.jpg"); // you can specify an image in the email.
$ Mail-> Body = 'Hello,
Friend!
This is an email from helloweba.com!
'; // Subject content
// Send
If (! $ Mail-> Send ()){
Echo "failed to send:". $ mail-> ErrorInfo;
} Else {
Echo "sent successfully! ";
}
?>
Http://www.bkjia.com/PHPjc/993867.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/993867.htmlTechArticlePHP mailer mail sent first download class library phpmailer because the load is smtp.163.php so the sender's mailbox to use 163 mailbox its mailbox without other class library import, my attachment .xls is you want...