Send Email From a PHP Script Using SMTP Authentication

When sending email it is recommended to use SMTP authentication for sending emails. If you are not using any CMS OR a custom coded website, use the steps below to enable SMTP authentication in your contact form.

Login to your cPanel & access option PHP PEAR Packages. Under Find a “PHP Extensions and Applications Package”, find for mail and click on Go. Install Mail which is listed under the Module Name as below.



Once you install the above package, download the contact.php file with a sample contact.html page from https://iithost.com/public/contact.tar

Replace the details below with the actual ones.

  • from: the email address from which you want the message to be sent
  • to: the recipient’s email address and name.
  • host: your outgoing SMTP server name.
  • username: the SMTP user name (typically the same as the username used to retrieve mail).
  • password: the password for SMTP authentication.

Once done, you can try sending the emails and the emails would be sent using SMTP authentication.

Was this answer helpful?

Related Articles

Using SMTP authentication to send email through WordPress

While sending email, it is generally a good idea to send using SMTP authentication....

Set up outgoing SMTP eMail for Magento

We recommend you to use Magento extension SMTP Pro when setting up external SMTP email for...

How to add "A Record" in cPanel

1. Login to cPanel 2. Click on Zone Editor button from DOMAINS section 3. Click on + A RECORD...

WordPress Security Guide

WordPress Security Guide   With so many websites relying on WordPress it’s no surprise that...