PHP uses QQ free enterprise mail to send email code

Source: Internet
Author: User
For small enterprises, free enterprise mail is a good choice, saving the cost of servers and personnel maintenance. Here we will talk about qq's free enterprise mailbox.

For small enterprises, free enterprise mail is a good choice, saving the cost of servers and personnel maintenance. Here we will talk about qq's free enterprise mailbox.

1. register an account

Web: http://exmail.qq.com

To register an account, you must have your own domain name.

2. add members

Note that the password you set when adding members cannot be used to send emails using phpmailer. You can use phpmailer to send emails only after you have logged on to this member and reset the password.

3. add dns

51yip.com. in mx 5 mxbiz1.qq.com.
51yip.com. in mx 10 mxbiz2.qq.com.

If you do not have your own DNS server, you can add two mx records. simply leave the host domain name empty. Take dnspod as an example.

4. test the PHP script

Include "PHPMailer/class. phpmailer. php ";

Function send_mail ($ frommail, $ tomail, $ subject, $ body, $ ccmail, $ bccmail ){
$ Mail = new PHPMailer ();
$ Mail-> IsSMTP ();
$ Mail-> SMTPDebug;
$ Mail-> Host = "smtp.qq.com ";
$ Mail-> SMTPAuth = true;
$ Mail-> Port = 25;
$ Mail-> Username = "admin@51yip.com ";
$ Mail-> Password = "******";

$ Mail-> AddReplyTo ($ frommail, 'tankzhang ');
$ Mail-> AddAddress ($ tomail );
$ Mail-> SetFrom ($ frommail, 'tankzhang ');

$ Mail-> IsHTML (true );
$ Mail-> Subject = $ subject;
$ Mail-> MsgHTML ($ body );

If (! $ Mail-> Send ())
{
Echo "failed to send the email.

";
Echo "error cause:". $ mail-> ErrorInfo;
Exit;
} Else {
Echo "success ";
}
}

$ Result = send_mail ("admin@51yip.com", "95219454@qq.com", "test", "test ","","");
?>

For small enterprises, free enterprise mail is a good choice, saving the cost of servers and personnel maintenance. Here we will talk about qq's free enterprise mailbox.

1. register an account

Web: http://exmail.qq.com

To register an account, you must have your own domain name.

2. add members

Note that the password you set when adding members cannot be used to send emails using phpmailer. You can use phpmailer to send emails only after you have logged on to this member and reset the password.

3. add dns

51yip.com. in mx 5 mxbiz1.qq.com.
51yip.com. in mx 10 mxbiz2.qq.com.

If you do not have your own DNS server, you can add two mx records. simply leave the host domain name empty. Take dnspod as an example.

4. test the PHP script

Include "PHPMailer/class. phpmailer. php ";

Function send_mail ($ frommail, $ tomail, $ subject, $ body, $ ccmail, $ bccmail ){
$ Mail = new PHPMailer ();
$ Mail-> IsSMTP ();
$ Mail-> SMTPDebug;
$ Mail-> Host = "smtp.qq.com ";
$ Mail-> SMTPAuth = true;
$ Mail-> Port = 25;
$ Mail-> Username = "admin@51yip.com ";
$ Mail-> Password = "******";

$ Mail-> AddReplyTo ($ frommail, 'tankzhang ');
$ Mail-> AddAddress ($ tomail );
$ Mail-> SetFrom ($ frommail, 'tankzhang ');

$ Mail-> IsHTML (true );
$ Mail-> Subject = $ subject;
$ Mail-> MsgHTML ($ body );

If (! $ Mail-> Send ())
{
Echo "failed to send the email.

";
Echo "error cause:". $ mail-> ErrorInfo;
Exit;
} Else {
Echo "success ";
}
}

$ Result = send_mail ("admin@51yip.com", "95219454@qq.com", "test", "test ","","");
?>

Related Article

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.