Ping "smtp.gmail.com" can pass, why Phpmailer but error
Ping Gmail's SMTP server in cmd to get through,
But in the Web site to do the sending of email programs, but always error:
SMTP error:could not connect to SMTP host. Mailer ERROR:SMTP error:could not connect to SMTP host.
What happened:
PHP Code
ISSMTP (); $mail->smtpauth = true; Enable SMTP authentication $mail->smtpsecure = "SSL"; Sets the prefix to the Servier $mail->host = "smtp.gmail.com"; Sets GMAIL as the SMTP server $mail->port = 465; Set the SMTP port for the GMAIL server $mail->username = "[email protected]"; GMAIL username $mail->password = "xxx"; GMAIL password $mail->from = "[email protected]"; $mail->fromname = "xxx"; $mail->subject = "Subject 111"; $mail->body = "Hi,
The HTML BODY
"; HTML Body $mail->altbody = "To view the message, please use an HTML compatible email viewer!"; Optional, comment out and test $mail->wordwrap = 50; Set word wrap $mail->msghtml ($body); $mail->addaddress ("[Email protected]", "xxx"); $mail->ishtml (TRUE); Send As HTML if (! $mail->send ()) {echo "Mailer Error:". $mail->errorinfo; } else {echo "Message sent!";} ?>
------Solution--------------------
discuss
Would it be the space quotient that made the restriction?
I am in the local test, with 163 of the mailbox can send e-mail, with Gmail also show this error, open Phpmailer debug mode display:
SMTP-error:failed to connect to server:unable to find the socket transport "SSL"-do you forget to enable it whe N You ...