Sending Email Using PHPMailer and SMTP

| Last Updated: | In: Core php


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.

Tags: , , , ,

About: Prem Tiwari

Prem Tiwari is founder of and Software developer from New Delhi (India). Follow Prem's development codes on facebook, and make sure you check out for the latest in web development related Tips with the complete code.

You may also like:

Follow us!

Get Free Access of 350+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Learn how to implement security guideline in your WordPress site...


Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...