Log In

This guide helps to setup your SMTP2GO server as Outgoing SMTP Server in Exim on RHEL and CentOS etc.

Step 1

Please change the following variables in this guide:

USERNAME: your SMTP2GO username.

PASSWORD: your SMTP2GO password.

Step 2

Edit Exim configuration file /etc/exim/exim.conf using your favourite editor such as vi or nano.

Step 3

Add a router with following lines of code:

smtp2go_router:
driver = manualroute
transport = smtp2go_relay
domains = ! +local_domains
route_data = mail.smtp2go.com

Step 4

Add a transport with following lines of code:

smtp2go_relay:
driver = smtp
port = 2525
hosts_require_auth = $host_address
hosts_require_tls = $host_address

Step 5

Add an Authenticator below begin authenticators with following lines of code.

Note: Please change the following variables in this guide:

USERNAME: your SMTP2GO username.
PASSWORD: your SMTP2GO password.

smtp2go_login:
driver = plaintext
public_name = LOGIN
hide client_send = : USERNAME : PASSWORD

Step 6

Restart the Exim service using one of the following commands:

/etc/init.d/exim restart

(OR)

service exim restart

Step 7

Optional: If you wish to only have particular domain names send via SMTP2GO, you can use one of the options below. All other emails will be sent directly from Exim’s built in sender.

(i)  Specify only certain domains (of the sender email address) to send through the smarthost

Create a text file to include the domains that should use SMTP2GO. For example, create a file  /etc/exim/authorized_senders.txt. Add domain names in below format into that file:

domain1.com: mail.smtp2go.com
domain2.com: mail.smtp2go.com

At ROUTER section of /etc/exim.conf file, change the router_data line as below:

route_data = ${lookup{$sender_address_domain}lsearch*{/etc/exim/authorized_senders.txt}}

Restart the Exim service.

(ii) Exclude certain domains (of the sender email address) from sending through the smarthost

Create a text file to exclude the domains from sending through the SMTP2GO. For example, create a file  /etc/exim/excludesenderdomains.txt. Add domain names in below format into that file:

domain1.com:
domain2.com:

Add the following line in the MAIN CONFIGURATION section:

domainlist exclude_sender_domains = lsearch;/etc/exim/excludesenderdomains.txt

Add the following line in the ROUTERSTART section after the ‘domains = ! +local_domains‘ line:

senders = !*@+exclude_sender_domains

Restart the Exim service.

Note: If you see an error ‘550 unable to verify sender address’ when trying to send an email after setting up, this means your ‘From’ email address doesn’t have a valid MX record setup yet. All emails must be sent from an email address that has an MX record at its domain name.

Ready for better email delivery?

Try SMTP2GO free for as long as you like:

Try SMTP2GO Free → Paid plans available for over 1,000 emails/month.