Sending Email Using PHPMailer and SMTP

phpmailer

This tutorial describes how to use PHPMailer and use of the PHPMailer class functions. Many PHP websites and web applications need to send transactional emails. PHP does have a mail() function you could use to send an email from the web server itself.

Step 1. Include the library and instantiate a PHPMailer object

For those who have not used PHP’s mail() function before, this section will provide information about email and e-mailing in general, in addition to explaining how to get started with PHPMailer.

Save it in the same directory where you’ve saved class.phpmailer.php. If you switched error messages and warnings off, then go ahead and set it on.

Step 2. set up the object to use SMTP and configure it to point to the proper server

Step 3. Set the email properties where you want to send email

Once you set up the way you want it, you call the object’s Send method. If the Send method returns true, then email send successfully to configures email address. If it returns false, then there was a problem in your phpmailer configuration.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , ,