How to setup Email by using SMTP

If you struggling with setup your Email Contact form or trying to set up your SMTP Email then you will find this article ( How to setup Email by using SMTP ) useful,

  1. Login to cPanel.
  2. Navigate to PHP PEAR Packages.
    PHP PEAR Packages
  3. Search for “Mail”
  4. Install Mail (1.4.1)
  5. Now its done. Use this below-attached PHP code or file with your application.

    require ‘Mail.php’;

    // Define basic e-mail parameters:
    $recipient = ‘[email protected]’;
    $headers[‘From’] = ‘[email protected]’;
    $headers[‘Reply-to’] = ‘[email protected]’;
    $headers[‘To’] = ‘[email protected]’;
    $headers[‘Subject’] = ‘This is the message subject’;
    $headers[‘Date’] = date(‘r’);
    $headers[‘Message-Id’] = ‘<‘ . uniqid() . ‘>’;
    $headers[‘Content-Type’] = ‘text/plain; charset=utf-8’;
    $body = ‘This is the message body’;

    // Define SMTP authentication parameters:
    $smtp_params[‘host’] = ‘’;
    $smtp_params[‘auth’] = true;
    $smtp_params[‘username’] = ‘username’;
    $smtp_params[‘password’] = ‘password’;

    // Create a Mail class instance with the above parameters, and then send the message:
    $message =& Mail::factory(‘smtp’, $smtp_params);
    $message->send($recipient, $headers, $body);


In this article we have seen that how to setup SMTP authetication using php script. This is simplest methd ever you going to find on search engines! Hope you understood this method.

About the Author: Reform Hosting

Reform Hosting is a leading Hosting Service provider, offering reliable, scalable solutions for customers of all sizes and services. We supply all of the servers, software, bandwidth and management tools needed to run almost any web hosted application – from small to enterprise server solutions. We are committed to excellent quality Service. Our staff has over 2+ years of experience in the IT field.

You May Also Like


  1. Very nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!

  2. As a college newbie, I relied on A Mum Reviews and their website for guidance on academic writing services. Their recommendations made my transition smoother. Thank you!

  3. where buy generic mobic [url=]how can i get cheap mobic no prescription[/url] buying mobic price

  4. cost of generic mobic pill [url=]where can i get cheap mobic without rx[/url] can you get cheap mobic no prescription

  5. zithromax antibiotic without prescription [url=]zithromax online usa[/url] where can i buy zithromax capsules

  6. canadianpharmacyworld com [url=]canadian pharmacy ltd[/url] canadian pharmacy ltd

  7. best online canadian pharmacy [url=]my canadian pharmacy reviews[/url] canada pharmacy world

  8. iSiJ’ AND 6083=CAST((CHR(113)||CHR(122)||CHR(122)||CHR(106)||CHR(113))||(SELECT (CASE WHEN (6083=6083) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(107)||CHR(122)||CHR(107)||CHR(113)) AS NUMERIC) AND ‘nIgq’=’nIgq

Leave a Reply

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