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

General Discussion

SMTP and hosting company

Hello y'all!

Basically I took up Randy Hoyt's advice and tried to use an external email server to handle the contact form on my website. I used PHPmailer as well. The way I set up the connection to this mailserver is as followed:

require_once("inc/packages/class.phpmailer.php");
            $mail = new PHPMailer();

            $mail->IsSMTP();               
            $mail->SMTPAuth = true;             
            $mail->SMTPSecure = "tls";                 
            $mail->Host = "smtp.gmail.com";     
            $mail->Port = 587;                 
            $mail->Username = "correctmail@gmail.com"; 
            $mail->Password = "totallysecure";

As you can see, I tried to use the gmail mail server (is that what I did? I'm new to this). Now, this totally worked on localhost, after changing some things in php.ini. I filled in my contact form, clicked send, and the mail arrived in my gmail inbox. Nice!

But then I uploaded it to my webhost, one.com. When I tried the form there, sending the form caused an error, saying it could not connect to the server.

When I contacted them, all they said was "You should use our smtp". Naturally, being a true internet freedomfighter, these words caused me to throw a tantrum.

What do you guys suggest I do?

2 Answers

Samuel Rueby
Samuel Rueby
22,538 Points

This won't be a great answer to your question but I think you will have way more success signing up for a free account at https://www.mandrill.com . You'll get like 12,000 emails/month before you have to pay for anything and the customer service is way better.

Thanks, yeah! (Any tips are welcome, I can only learn from them ;-))

I guess that for now I'll have to live with the fact that I have to use their email servers, as long as I can't connect to any others. The only positive thing about it is that apparently if I use their email services as well to send the e-mails to, I can send an unlimited amount.