Phpmailer simple mail sending method (with phpmailer source code download), phpmailer source code download. Phpmailer simple mail sending method (with phpmailer source code download), phpmailer source code download this article example describes phpmailer simple mail sending method. Share it with you for your reference. you can use phpmailer to simply send emails (with phpmailer source code download) and phpmailer source code download.
This example describes how phpmailer simply sends emails. We will share this with you for your reference. The details are as follows:
First, click hereDownload from this siteCorresponding php file.
After decompression, there are 2 php files (2 classes) and 1 html file (API)
Put two php files in the php project
Brief description: here I use a 163 email to send a message to the 126 email address.
The key code is as follows:
<? Php require 'class. phpmailer. php '; $ mail = new PHPMailer (true); // Create a mail sending class $ mail-> CharSet = "UTF-8 "; // Set the encoding type of information $ address = "****** @ 126.com"; // recipient address $ mail-> IsSMTP (); // use SMTP to send $ mail-> Host = "smtp.163.com"; // use the 163 email server $ mail-> SMTPAuth = true; // enable the SMTP verification function $ mail-> Username = "****** @ 163.com "; // your 163 server email account $ mail-> Password = "******"; // 163 email Password $ mail-> Port = 25; // email server port $ mail-> From = "****** @ 16 3. com "; // email address of the sender $ mail-> FromName =" test email "; // sender name $ mail-> AddAddress (" $ address "," Zhang San "); // the recipient address, which can be replaced with any email address in the format of AddAddress ("recipient email", "recipient name") $ mail-> AddAttachment ("D: \ abc.txt "); // add an attachment (note: The path cannot contain Chinese characters) $ mail-> IsHTML (true ); // use the HTML format $ mail-> Subject = "test"; // mail Title $ mail-> Body = "Happy New Year"; // mail content, if HTML is set above, it can be HTML if (! $ Mail-> Send () {echo "failed to Send the email."; Echo" error cause: ". $ mail-> ErrorInfo; exit ;}?>
I hope this article will help you with php programming.
Pipeline (with phpmailer source code download), phpmailer source code download this example describes phpmailer simple mail method. Share it with you for your reference,...