Ping "smtp.gmail.com" can pass, why Phpmailer but error

Source: Internet
Author: User
Tags word wrap gmail password
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 ...
  • 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.