Log In

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

For Debian based distros, follow these other instructions.

Step 1

Please change the following variables in this guide:

USERNAME: your SMTP2GO username.

PASSWORD: your SMTP2GO password.

Step 2

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

Step 3

After
begin routers
add a router with the following lines of code:

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

Step 4

After
begin transports
add a transport with the 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 the 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

(OR)

systemctl restart exim

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 the below format into that file:

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

In the ROUTER section of /etc/exim.conf, change the route_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 domains from sending through SMTP2GO. For example, create a file  /etc/exim/excludesenderdomains.txt. Add domain names in the below format into that file:

domain1.com:
domain2.com:

In the ROUTER section of /etc/exim.conf, change the route_data line as below:

route_data = ${lookup{$sender_address_domain}lsearch*{/etc/exim/excludesenderdomains.txt}{}{mail.smtp2go.com}}

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.