Sending Email Using PHPMailer and SMTP

Prem Tiwari - - PHP Tutorial


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.

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.