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.
First you need to make sure the email address(es) you will be sending from have been authorized in the Control Panel.
Download the latest version of PHPMailer from Github
Upload the extracted directory to your website
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
- 'YOU@YOUR-DOMAIN-NAME.COM' 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