PHP Build a Basic PHP Website (2018) Adding a Basic Form SMTP with Google

Erik Gratz
Erik Gratz
17,974 Points

SMTP Error: Could not connect to SMTP host.

I get the following error when trying to use my gmail account as described in the video. No idea whats wrong.

2019-01-20 18:11:32 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP u19sm5543933oia.31 - gsmtp 2019-01-20 18:11:32 CLIENT -> SERVER: EHLO localhost 2019-01-20 18:11:33 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2600:1700:7920:3350:9902:b951:bd9e:7a81]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250 SMTPUTF8 2019-01-20 18:11:33 CLIENT -> SERVER: STARTTLS 2019-01-20 18:11:33 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS SMTP Error: Could not connect to SMTP host. 2019-01-20 18:11:33 CLIENT -> SERVER: QUIT 2019-01-20 18:11:33 2019-01-20 18:11:33 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Eric Drake
Eric Drake
Pro Student 6,227 Points

Could you show me the PHP code you are using to connect to Gmail?