Send email using PHPMailer with PHP and SMTP

This article only concerns with Shared and Reseller hosting packages on our server. We do not support any external SMTP servers to send email from our Shared and Reseller hosting accounts. You need to use our hosting servers to send emails using SMTP. 

Follow the steps below to send SMTP emails from your shared/reseller server. 

Install PHPMailer using composer

  1. Login to your account using SSH and go to the root of your application directory. 
  2. Type composer require phpmailer/phpmailer

Test the installation

    1. Create a file to test the installation of the composer package
      user@server [~/public_html] vi mailtest.php​
    2. paste the following code in the file you created above
      use PHPMailer\PHPMailer\PHPMailer;
      require 'vendor/autoload.php';
      $mail = new PHPMailer();
      $mail->Host = gethostname();
      $mail->SMTPAuth = true;
      $mail->Username = '';
      $mail->Password = 'password';
      $mail->Subject = 'Email subject';
      $mail->Body    = 'Email body';
    3. Test the setup by running the file from the command line
      user@server [~/public_html] php mailtest.php​

Please note that our shared and reseller hosting has a limitation of 500 emails per hour and 1000 emails per day. We do not support bulk mail through our servers. Please contact us if you have more requirements for email services. 

  • php, email, phpmailer
  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

How to access shared cPanel server using SSH

We support SSH access to our shared and reseller cPanel servers. To access your server using SSH,...

Powered by WHMCompleteSolution