Phpmailer failed to send the email
IsSMTP (); // use SMTP to send $ mail-> Host = "smtp.qq.com"; // your enterprise Post Office domain name $ mail-> SMTPAuth = true; // enable SMTP authentication function $ mail-> Username = "963529987@qq.com"; // Post Office Username (enter the complete email address) $ mail-> Password = "************"; // Post Office Password $ mail-> Port = 25; $ mail-> From = "963529987@qq.com"; // mail sender email address $ mail-> FromName = "liuyoubin"; $ mail-> AddAddress ("$ address ", "a"); // recipient address, which can be replaced with any email address in the format of AddAddress ("recipient email", "recipient name ") // $ mail-> AddReplyTo ("", ""); // $ mail-> AddAttachment ("/var/tmp/file.tar.gz "); // add an attachment // $ mail-> IsHTML (true); // set email format to HTML // whether to use the HTML format $ mail-> Subject = "PHPMailer test mail "; // mail Title $ mail-> Body = "Hello, this is the test mail "; // U email content $ mail-> AltBody = "This is the body in plain text for non-HTML mail clients"; // additional information, which can be omitted if (! $ Mail-> Send () {echo "failed to Send the email."; Echo" error cause :". $ mail-> ErrorInfo; exit;} echo "email sent successfully "; /*************************************** * ********* 34 35 attachment: 36 phpmailer Chinese instructions (simple version) start with 37A: 38 $ AltBody -- attribute 39 from: PHPMailer ::$ AltBody40 File: class. phpmailer. php41 description: the setting of this attribute is that the backup display of HTML is not supported in the mail body. 42AddAddress -- method 43 comes from: PHPMailer: AddAddress (), File: class. phpmailer. php44 description: Add recipients. Parameter 1 is the recipient's mailbox, and parameter 2 is the recipient's name. Example AddAddress ("eb163@eb163.com", "eb163"), but parameter 2 is optional, AddAddress (eb163@eb163.com) is also possible. 45 function prototype: public function AddAddress ($ address, $ name = '') {} 46AddAttachment -- method 47 from: PHPMailer: AddAttachment () 48 File: class. phpmailer. php. 49 Note: add attachments. 50 parameter: Path, name, encoding, type. Among them, the path is required, and others are optional 51 function prototype: 52 AddAttachment ($ path, $ name = '', $ encoding = 'base64 ', $ type = 'application/octet-stream') {} 53AddBCC -- Method 54 from: PHPMailer: AddBCC () 55 File: class. phpmailer. php56 description: add a BCC. For the differences between CC and BCC, see [differences between BCC and CC in SMTP sending]. 57. parameter 1 is the address and parameter 2 is the name. Note that this method only supports SMTP in win32, and does not support the mail function 58 function prototype: public function AddBCC ($ address, $ name = '') {} 59 AddCC -- method 60 from: PHPMailer: AddCC () 61 File: class. phpmailer. php62 note: add a CC. For the differences between CC and BCC, see [differences between BCC and CC in SMTP sending]. 63 parameter 1 is the address and parameter 2 is the name. Note that this method only supports SMTP in win32, and does not support the mail function 64 function prototype: public function AddCC ($ address, $ name = '') {} 65AddCustomHeader -- method 66 from: PHPMailer: AddCustomHeader () 67 File: class. phpmailer. php68 note: add a custom email header. 69 parameter is header information 70 function prototype: public function AddCustomHeader ($ custom_header) {} 71 AddEmbeddedImage -- method 72 from: PHPMailer: AddEmbeddedImage () 73 File: class. phpmailer. php74 description: add an embedded image 75 parameter: path, return handle [, name, encoding, type] 76 function prototype: public function AddEmbeddedImage ($ path, $ cid, $ name = '', $ encoding = 'base64', $ type = 'application/octet-stream') {} 77: AddEmbeddedImage (PICTURE_PATH. "index_01.jpg", "img_01", "index_01.jpg"); 78 reference 79 in html AddReplyTo -- method 80 from: PHPMailer :: addRepl81 *************************************** * *********/82?>
Why can't I send an email using phpmailer? why?
SMTP Error: cocould not authenticate. the email failed to be sent.
Cause of Error: SMTP Error: cocould not authenticate.
SMTP server error:
Reply to discussion (solution)
Authentication failed. Check the authentication code
Authentication failed. Check the authentication code... I don't fully understand the code .. Ah
$ Mail-> Username = "963529987@qq.com"; // Post Office Username (enter the complete email address)
$ Mail-> Password = "************"; // Post Office Password
Verification fails under these two checks ~ Incorrect account or password
Try to register a new 163 mailbox. QQ mailbox seems to have restrictions
$ Mail-> Username = "963529987@qq.com"; // Post Office Username (enter the complete email address)
$ Mail-> Password = "************"; // Post Office Password
Verification fails under these two checks ~ Incorrect account or password
My password is correct. I don't understand what the Post Office user name is, not the email address of the email sender?
$ Mail-> Username = "963529987@qq.com"; // Post Office Username (enter the complete email address)
$ Mail-> Password = "************"; // Post Office Password
Verification fails under these two checks ~ Incorrect account or password
My password is correct. I don't understand what the Post Office user name is, not the email address of the email sender?
It is an email address. check whether smtp in QQ mail has been opened.