PHP Mailer 5.x - SMTP Setup Guide

Are you using the latest version of PHP Mailer?
Please see our PHP Mailer 6.x setup guide here.

Important Points

  • PHPMailer is an advanced email PHP framework for use on PHP enabled web servers. These instructions will guide you through setting up PHPMailer to use AuthSMTP as an authenticated SMTP server.
  • These instructions are a basic guide to explain the changes needed to the PHPMailer configuration files to use AuthSMTP as an authenticated SMTP server. They are not a guide to a complete or secure setup of PHPMailer, for further instructions on using and securing PHPMailer please see their page on Github - PHPMailer.
  • You should ensure that your code is able to gracefully handle errors in not being able to transmit messages to our network. While we endeavour to provide maximum availability for our service there is always the possibility of connectivity or other technical issues beyond our (or your) control. Ideally error handling, logging, message queueing (with retry) and monitoring should all be considered.
  • These instructions are only for PHPMailer - for other email programs or scripting languages please see How To Setup AuthSMTP or contact us.

Step 1

  • First you need to make sure the email address(es) you will be sending from have been authorized in the Control Panel.

Step 2

  • Download the latest version of PHPMailer from Github
  • Upload the extracted directory to your website

Step 3

  • Create a file in the same directory called 'authsmtp-test.php' containing only the following code:
  • Change the following lines:

    - 'USERNAME' to your AuthSMTP username

    - 'PASSWORD' to your AuthSMTP password

    - '[email protected]' to your email address

    - 'YOUR NAME' to your name or company name

  • Save and upload your authsmtp-test.php file to the same directory as the PHPMailer files.
  • Open a web browser and view the uploaded authsmtp-test.php file on the Internet.
  • You should see a message saying "Message has been sent".
  • This means that AuthSMTP can be used from your web server and you can continue to integrate this into your form / application.
  • We recommend that when you do, you store the username and password variable definitions in a separate PHP file outside your public web directory and reference back to it. Storing them in a public PHP file is a potential security risk.


  • Change the value for $mail->SMTPDebug to '2' and re-run the script
  • Check your web server error logs for issues
  • Try one of the alternative ports - 23, 25, 26, 2525, 80
  • Check the username and password that you have entered are correct
  • Check with your Network Administrator or Hosting company that external access on one of the ports is possible
  • Check the permissions on the files you have uploaded
  • Check that you have validated the 'From Address' on your account, you can check or start the validation process by logging into the Control Panel


  • If you believe there is a problem with your AuthSMTP account please login to the Control Panel and check the following:
    • You are using the correct username and password, it is possible to set separate passwords for logging into the control panel and for sending email.
    • That your account hasn't expired.
    • See if there is any errors being logged against your account such as unauthorised emails addresses etc.
  • For further support please contact either your web hosting company or check the support resources for PHPMailer.