Setting up Exim with SMTP2GO

Posted

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.

Author