Phpmailer mail sending instance (163 mailbox 126 mailbox yahoo mailbox)

Source: Internet
Author: User
Tags php email
Phpmailer is an excellent php email sending plug-in. it can be used to send messages in almost any email address. next I will introduce the sending method of 163 mailbox 126 mailbox yahoo mailbox. preparation: we must register an email (163 Email 1... phpmailer is an excellent php email sending plug-in. it can be used to send messages in almost any email address. next I will introduce the sending method of 163 mailbox 126 mailbox yahoo mailbox.

Preparations:You must register an email address (163 mailbox, 126 mailbox, yahoo mailbox ).

Note:These mailboxes must support login and sending. We do not configure these mailboxes.

163 email $ mail-> Host = "smtp.163.com ";

126 email $ mail-> Host = "smtp.126.com ";

Yahoo mail $ mail-> Host = "smtp.mail.yahoo.com.cn ";

You must write your own username and password in the same way in other places. I use 163 email as an example and the code is as follows:

 "; // Use SMTP to send emails $ mail-> IsSMTP (); // the email server $ mail-> Host =" smtp.163.com "; $ mail-> SMTPDebug = 0; // use SMPT to verify $ mail-> SMTPAuth = true; // SMTP-verified user name $ mail-> Username = "******** @ 163.com "; // SMTP authentication secrets $ mail-> Password = "***"; // sets the encoding format $ mail-> CharSet = "UTF-8 "; // set the topic $ mail-> Subject = "test"; // $ mail-> AltBody = "To view the message, please use an HTML compatible email viewer! "; // Set the sender $ mail-> SetFrom ('***** @ 163.com', 'test '); // send an email in html format $ mail-> MsgHTML ($ body); // recipient's email name $ mail-> AddAddress ("*** @ 163.com"," test "); // send the email if (! $ Mail-> Send () {echo "Mailer Error:". $ mail-> ErrorInfo;} else {echo "Message sent! ";}?>

Note that the red part is modified according to your own needs.


Address:

Reprinted at will, but please attach the article address :-)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.