Sending outbound email through remote mail server

To set up outbound email sending through remote mail server, fill in example values and copy generated snippets to their respective files. If Remote mail server requires custom port, it could be added by appending ::PORT to the hostname (e.g. mail.example.com::587)

Remote server hostname:

Remote server requires authentication:

/etc/exim.routers.pre.conf

smart_route_forward:
    driver = manualroute
    domains = ! +local_domains
    ignore_target_hosts = 127.0.0.0/8
    condition = ${if !eq{$original_domain}{$domain}}
    condition = ${if !eq{$original_domain}{}}
    condition = "${perl{check_limits}}"
    
    transport = remote_smtp_forward_transport

    route_list = * smtp.example.com
    no_more

smart_route:
    driver = manualroute
    domains = ! +local_domains
    ignore_target_hosts = 127.0.0.0/8
    condition = "${perl{check_limits}}"

    transport = remote_smtp

    route_list = * smtp.example.com
    no_more

For changes to take effect, exim will need to be restarted using

systemctl restart exim
Last Updated: