Add to Favourites    Print this Article

How to Setup SMTP in WHMCS

As a web hosting service provider, you have to ensure that you’re able to communicate with your clients effectively and on time. We’ve already seen that several events in WHMCS generate a notification based on various triggers. Invoices, reminders, domain changes, account creation etc. – all of these keep in touch with users via email. Therefore, you need to do everything in your power to make sure that your emails are getting through. What’s the use of sending several notifications if your clients never see them? This is not merely a question of a mail server configuration error. You also want to prevent your emails from getting sent to the user’s spam folder.

Even if the IP address you’re using for your server has not been blacklisted by your user’s email provider, the still a chance that your message will be sent to spam. This is because by default WHMCS uses a technique to send email known as PHP “sendmail”. while this is the easiest way for a program like WHMCS to quickly send email using the server’s resources, its very ease-of-use makes it a preferred mode of attack for email spammers. Therefore, several email servers including public ones like Gmail send email dispatched via this technique directly to the spam folder.

It is therefore necessary to configure WHMCS in such a way that it sends email using a different technique. For us, that means switching to SMTP instead of the PHP sendmail function. To set it up you’ll need access to not only your WHMCS installation, but also to the cPanel account under which WHMCS is functioning. Let’s look at how to set up SMTP for reliable emails:

Enabling SMTP For Emails

The main settings are located under “General Settings” via the “Setup” tab on the WHMCS administration dashboard. Clicking this brings up a screen with a large number of tabs, one of which will be titled “Mail”.

default php change to smtp

Switch to it, and the first field is a drop-down box containing two items:

  1. PHP Mail()
  2. SMTP

You can see that the first one is enabled by default. Simply open the drop-down box and choose the second option instead. Now we need to fill in the rest of the details to get SMTP to work with WHMCS.

Obtaining SMTP Details

Log into your cPanel account and under the “Mail” section, search for “Email Accounts”. This will bring you to a screen containing all of the email IDs that you’ve created. Choose the one with which you intend to send emails from WHMCS. In my case, I’ve settled on You can see that it’s present as one item in the list below:

configure email client

To the right-hand side, you’ll see an icon titled “More”. Clicking this brings a drop-down box containing two items, one of which will be called “Configure Email Client”. When you click this, you’ll be taken to the mail configuration section containing the details of the SMTP mail server linked to the email ID you just chose.

Ignore the automatic setup scripts for well-known applications and scroll down. We are interested in the SMTP settings as shown below:

get SMTP details

The four pieces of information we are interested in from this screen are:

  1. Outgoing Server
  2. SMTP Port
  3. Username
  4. Password

The first one – “Outgoing Server” – is to be placed in the “SMTP Host” field.

SMTP details

The rest of them are self-explanatory. You can of course fill in the rest of the details like the email signature you want to associate with your web hosting account as well as the CSS styling. Once you’ve saved these details, it’s time to see whether our system works or not.

For testing purposes, I logged in as a user and created a random ticket. As we’ve seen earlier, this generates an automatic email notification to the ID of the user who created it. Logging into my email ID, I can see that I have received the notification as shown here:

email received

So there you have it – a proper way of sending email to your clients without being worried that your notifications are being tossed off into the spam folder. This will increase the reliability of your communications and ensure that important deadlines don’t get missed.

Yes No

Also Read