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 trialAleksandr Antropov
6,458 PointsHow to send an email via SMTP (Google) with Swiftmailer on localhost (WAMP)
If you are running a project on a localhost (in my case - WAMP) you are going to have issues with sending an email. I encountered this error: Connection could not be established with host smtp.gmail.com [ #0]
The source of an error is unknown to me. However there is a workaround:
- Go to \vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport;
- Open 'StreamBuffer.php';
- Go to line 266 and paste the following code before '$streamContext' assignment:
$options['ssl']['verify_peer'] = FALSE; $options['ssl']['verify_peer_name'] = FALSE;
This will allow us to send emails within our testing environment.