Skip to content

Commit

Permalink
Update gmail.phps
Browse files Browse the repository at this point in the history
The internet is littered with people trying to figure out why PHPMailer doesn't work for them with GMail.  ISPs like Digital Ocean do not support SMTP traffic over IPv6, but Google is IPv6 ready so PHPMailer waits a long time trying that before it tries IPv4.  That wait is either a major bottleneck, or a failure point as execution timeouts come into play.
See https://www.digitalocean.com/community/questions/outgoing-connections-on-port-25-587-143-blocked-over-ipv6
and
https://stackoverflow.com/questions/20068484/phpmailer-using-gmail-smtp-slow-when-sending-emails for example
  • Loading branch information
Greg Rundlett committed Jul 17, 2015
1 parent c99f3dd commit c1c20f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/gmail.phps
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ $mail->Debugoutput = 'html';

//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
// use
// $mail->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6

//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
Expand Down

0 comments on commit c1c20f2

Please sign in to comment.