Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?