how-to-setup-smtp-authentication

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.
    login-into-cpanel
  2. Navigate to PHP PEAR Packages.
    PHP PEAR Packages
  3. Search for “Mail”
    search-for-mail
  4. Install Mail (1.4.1)
    install-Mail
  5. Now its done. Use this below-attached PHP code or file with your application.

    <?php
    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() . ‘@example.com>’;
    $headers[‘Content-Type’] = ‘text/plain; charset=utf-8’;
    $body = ‘This is the message body’;

    // Define SMTP authentication parameters:
    $smtp_params[‘host’] = ‘mail.reformhosting.com’;
    $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);
    ?>


    Conclusion

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

Leave a Reply

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