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

Konrad Pilch
Konrad Pilch
2,435 Points

How to set up a web mail

Hi,

So in my portfolio i got contact form and the backend is coded with this tutorial.

But im not sure about the other part? i need a web mail server ? or something like that?

What should i do form the point after coding it ?

1 Answer

Michael Bianchi
Michael Bianchi
2,488 Points

To set up a mailing system in php, I recommend heading over to code.google.com/phpmailer (I think that's it, if not just search "phpmailer".

It is a third-party library with much mail functionality and security built right into it. It will download as a folder and you should upload it to your root directory (it really doesn't matter where, I suppose, as long as you reference it in your code).

You can include and instantiate the class like this:

<code> require_once("../phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); </code>

Then you can use all the mail functions you need. Test it on a live server because your localhost will most-likely not be configured to handle mail.

Then it's just as simple as $mail->Send(); But be sure to use their built-in functions to check and validate the email. It has a built-in $mail->ValidateAddress() function for that.

If you need further explanation, please let me know. There may be others better at explaining this, but what I said will accomplish your goal.