SMTP for PHPMailer classWhat is SMTP
Simple Mail Transfer Protocol (SMTP) is widely used internet protocol to manage mail. You have already seen how PHPMailer is installed and used to send mail. We will learn how to send mail using PPHPMailer through SMTP.
For testing the script in your host, it is always better you take one email account by pointing MX record to your hosting account. If you are hosting your mail account in other servers ( other than your own hosting server ) they check that your host is allowing to use other SMTP server or not.
In our previous example we have seen how we included the class and created mail object. Now to test SMTP with PHPMailer we will included another file which will also load our required SMTP classes.
The included file PHPMailerAutoload.php is part of the zip file you have downloaded and installed to use PHPmailer class. All details are explained in our previous tutorial on PHPMailer.
Host address.Your host will provide you with the address of its SMTP server. It can be one of the following address.
For Hostgator : mail.yourdomain.com
For godaddy.com : relay-hosting.secureserver.net
Godaddy.com allows by using localhost as host name, try using localhost if you are a godaddy customer.