PHP uses Phpmailer to send mail?

Source: Internet
Author: User

Define a mail Send function
function SendMail ($address, $title, $message) {

//导入mail类文件require("./PHPMailer/class.phpmailer.php");//创建mail对象$mail=new PHPMailer();$mail->IsSMTP();$mail->Host="smtp.163.com";$mail->SMTPAuth =true;$mail->Username= "18501773419@163.com";$mail->Password= "x x x x x x";$mail->From    = "18501773419@163.com";$mail->FromName= "乐分享weshare";$mail->AddAddress($address);$mail->IsHTML(true);$mail->Subject=$title;$mail->Body   =$message;

if (! $mail->send ()) {

 return true;

}else{

 return false;

}

}
SendMail ("18501773419@163.com", "Test", "Hello I Am Peace");
?>
PHP uses Phpmailer to send messages that are not authenticated (SMTP error:could not authenticate.), after commenting out the verification code, and then showing the following from address failed:?

Reply content:

Define a mail Send function
function SendMail ($address, $title, $message) {

//导入mail类文件require("./PHPMailer/class.phpmailer.php");//创建mail对象$mail=new PHPMailer();$mail->IsSMTP();$mail->Host="smtp.163.com";$mail->SMTPAuth =true;$mail->Username= "18501773419@163.com";$mail->Password= "x x x x x x";$mail->From    = "18501773419@163.com";$mail->FromName= "乐分享weshare";$mail->AddAddress($address);$mail->IsHTML(true);$mail->Subject=$title;$mail->Body   =$message;

if (! $mail->send ()) {

 return true;

}else{

 return false;

}

}
SendMail ("18501773419@163.com", "Test", "Hello I Am Peace");
?>
PHP uses Phpmailer to send messages that are not authenticated (SMTP error:could not authenticate.), after commenting out the verification code, and then showing the following from address failed:?

Mailbox needs to turn on the SMTP service, you can set the ~ 163 mailbox in the mailbox should be assigned the SMTP password separately

(PS: Use QQ mailbox sent to note that the port number is not the default of!!!)

Class.smtp.php's not require.
Look at the log of the environment and raise the debug level of the next phpmailer to see

  • 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.