Can not send mail through PHPMailer

This is my php code

require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = ""; // SMTP server $mail->From = ""; $mail->AddAddress(""); $mail->Subject = "First PHPMailer Message"; $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer."; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; }

My php.ini has this mail configuration [mail function]

SMTP = smtp_port = 465 sendmail_from

My error is

The following From address failed: Message was not sent.Mailer error: The following From address failed: SMTP server error: 5.7.0 Must issue a STARTTLS command first. i1sm13250552pbv.49

please help me.thanks in advance......

Answer1: requires that you use SSL and port 587 or 465.


firstly be sure you have the last version of phpmailer()

download it from

open class.phpmailer.php by php editor

replace all "HELO" words to "EHLO"

EHLO (not HELO) must be given by client before AUTH. (FOR GOOGLE MAIL)

it will be solved.


try phpgmailer once


Change your host to


人吐槽 人点赞



用户名: 密码:
验证码: 匿名发表


查看评论:Can not send mail through PHPMailer