Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

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

1 Answer

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