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

WordPress

Carl Sergile
Carl Sergile
16,570 Points

Will PHP Mailer Work in WOrdPResS?

Hey I feel like I've been googling this for hours now. So I'm trying to find the best practice in sending an emails using PHP Mailer using Gmail STMP in WordPress. I seem to run across a ton of different ways to do this but non have been able to convince me that this is the true way to do this. I'm trying to learn this the right ways so I can hook up this service for potential clients. I don't want to be liable for sensitive client information that gets sent thru email and is hacked or whatever can happen online. If one of the Treehouse teacher/moderators can explain how to do this/how it works, then I will have faith in what I am doing. I will be posting this in the PHP/WordPress section of the forum so this could reach ppl in both subjects. Here are some links I've already checked out but don't know if they are doing this in the best possible way:

http://brandintellect.in/send-email-gmail-smtp-wordpress-wp_mail/ http://www.butlerblog.com/2012/09/23/testing-the-wp_mail-function/ https://www.saotn.org/send-authenticated-smtp-email-over-tls-wordpress/ http://php.codeindepth.com/php-sending-mail/ https://wordpress.org/support/topic/phpmailer-1 http://stackoverflow.com/questions/16048347/send-email-using-gmail-smtp-server-through-php-mailer

Thanks!

1 Answer

Andrew McCormick
Andrew McCormick
17,730 Points

I think the best way to do what you are trying to achieve is to use SendGrid. Then just install the sendgrid plugin. All mail will be routed through the Sendgrid servers.

Carl Sergile
Carl Sergile
16,570 Points

Trying to achieve this without a plugin...I want to learn how to hardcode this into a template and then give directions to future developers to change this how they see fit.