Overview
In this article, we will explore how to set up a Smarthost SMTP relay with Webuzo. Here, we’ll demonstrate the configuration using the SMTP2GO relay host as an example. However, you can adapt these steps to set up any SMTP relay by referring to the provided example.
Set Up smarthost SMTP Relay
1. Go to Webuzo Admin Panel > Email > Mail Settings.
2. Select the custom code option from the Exim Configuration Manager.
3. From the Section Header dropdown, select 'begin authenticators', and from the Rule dropdown, select 'dovecot_login'. Enter the Auth code provided in the SMTP provider's documentation, then click the 'Add Custom Code' button to save.
4. Select the 'begin routers' from the Dropdown List, add router code provided in the SMTP provider's documentation and click on the 'Add Custom Code' button to save the code.
5. Select the 'begin transports' from the Dropdown List, add transport code provided in the SMTP provider's documentation and click on the 'Add Custom Code' button to save the code.
IP-based Authentication
To configure a smart host SMTP relay that supports IP-based authentication, please refer to SpamExperts configuration. In the configuration, you need to replace 'smtp.antispamcloud.com' with your SMTP host and '587' with your port number to make it work with your smart host.
For SMTP2GO, you can refer to the below configuration
1. Add code in the authenticators section.
smtp2go_login:
driver = plaintext
public_name = LOGIN
#specify your smtp2go SMTP username and password below
hide client_send = : smtp_username : smtp_password
2. Add below code in the routers section.
send_via_smtp2go:
driver = manualroute
domains = ! +local_domains
transport = smtp2go_smtp
route_list = * mail.smtp2go.com
host_find_failed = defer
no_more
3. Add below code in the transport section.
smtp2go_smtp:
driver = smtp
port = 25
hosts = mail.smtp2go.com
hosts_require_auth = <; $host_address
message_linelength_limit = 99999999
For MailChannels, you can refer to the below configuration
1. Add code in the authenticators section.
mailchannels_login:
driver = plaintext
public_name = LOGIN
#specify your mailchannels SMTP username and password below
client_send = : smtp_username : smtp_password
2. Add below code in the routers section.
send_via_mailchannels:
driver = manualroute
domains = ! +local_domains
transport = mailchannels_smtp
hosts_randomize = true
route_list = * smtp.mailchannels.net::25 randomize byname
host_find_failed = defer
no_more
3. Add below code in the transport section.
mailchannels_smtp:
driver = smtp
hosts_require_auth = *
hosts_require_tls = *
tls_tempfail_tryclear = true
headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*}\
{$authenticated_id} {${if match {$authenticated_id}{.+}\
{$authenticated_id@$primary_hostname}{$authenticated_id}}}}
dkim_domain = ${lc:${domain:$h_from:}}
dkim_selector = x
dkim_canon = relaxed
dkim_private_key = /var/webuzo-data/mail/dkim/private/${perl{untaint}{${dkim_domain}}}
You can find your SMTP credentials on the MailChannels Dashboard under Account > SMTP Passwords. Click the eye icon to see your username and password..
For turboSMTP, you can refer to the below configuration
1. Add code in the authenticators section.
turbosmtp_login:
driver = plaintext
public_name = LOGIN
#specify your turbosmtp account username and password below
client_send = : smtp_username : smtp_password
2. Add below code in the routers section.
send_via_turbosmtp:
driver = manualroute
domains = ! +local_domains
transport = turbosmtp_smtp
route_list = "* pro.turbo-smtp.com::587 byname"
host_find_failed = defer
no_more
3. Add below code in the transport section.
turbosmtp_smtp:
driver = smtp
hosts = pro.turbo-smtp.com
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address
For SendGrid, you can refer to the below configuration
1. Add code in the authenticators section.
sendgrid_login:
driver = plaintext
public_name = LOGIN
#specify your sendgrid apikey below
client_send = : apikey : your_apikey
2. Add below code in the routers section.
send_via_sendgrid:
driver = manualroute
domains = ! +local_domains
transport = sendgrid_smtp
route_list = "* smtp.sendgrid.net::587 byname"
host_find_failed = defer
no_more
3. Add below code in the transport section.
sendgrid_smtp:
driver = smtp
hosts = smtp.sendgrid.net
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address
For mailrelay, you can refer to the below configuration
1. Add code in the authenticators section.
mailrelay_login:
driver = plaintext
public_name = LOGIN
#specify your mailrelay's smtp username and password below
client_send = : smtp_username : smtp_password
2. Add below code in the routers section.
send_via_mailrelay:
driver = manualroute
domains = ! +local_domains
transport = mailrelay_smtp
route_list = * smtp1.s.ipzmarketing.com byname
3. Add below code in the transport section.
mailrelay_smtp:
driver = smtp
hosts = smtp1.s.ipzmarketing.com
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address
You can find your SMTP settings on the under Settings > SMTP settings.
Please note that to use Mailrelay's SMTP, you need to configure Mailrelay's provided SPF and DKIM records for all domains. Otherwise, you won't be able to enable the SMTP option.
For SpamExperts, you can refer to the below configuration
1. Add below code in the router section.
spamexperts_smarthost_router:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
headers_add = ${if !eq{$original_domain}{$domain}{X-Forwarded-For: $original_local_part@$original_domain}}
headers_add = X-AuthUser: $authenticated_id
transport = spamexperts_smarthost_transport
route_list = $domain smtp.antispamcloud.com::587
no_more
2. Add below code in the transport section.
spamexperts_smarthost_transport:
driver = smtp
interface = <; ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
port = 587
hosts_require_tls = *
dkim_domain = ${lc:${domain:$h_from:}}
dkim_selector = x
dkim_canon = relaxed
dkim_private_key = /var/webuzo-data/mail/dkim/private/${perl{untaint}{${dkim_domain}}}
1. Add code in the authenticators section.
spamexperts_login:
driver = plaintext
public_name = LOGIN
#specify your username and password below
client_send = : username@domain.com : your_user_password
2. Add below code in the routers section.
spamexperts_smarthost_router:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
transport = spamexperts_smarthost_transport
route_list = $domain smtp.antispamcloud.com::587
no_more
3. Add below code in the transport section.
spamexperts_smarthost_transport:
driver = smtp
port = 587
hosts_require_tls = *
hosts_require_auth = *
interface = <; ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
dkim_domain = ${lc:${domain:$h_from:}}
dkim_selector = x
dkim_canon = relaxed
dkim_private_key = /var/webuzo-data/mail/dkim/private/${perl{untaint}{${dkim_domain}}}
If you dont have SpamExperts user account, Click Here to access the official documentation.