Good day,
I have been struggling to get this to work and I am not sure if what I am doing is correct. We use SpamExperts as our filtering server. We have currently configured all sending domain names to route emails via the smarthost by having the following in place In my `/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 = * hostname::587
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 = * hostname::587
no_more
````
And in my `/etc/exim.transports.pre.conf` I have the following:
```
spamexperts_smarthost_transport:
driver = smtp
port = 587
hosts_require_tls = hostname
```
This works 100% and is sending out emails, but as mentioned, its applying this route for ALL sending domain names. And instead, we want only specific domain names to pass via the smarthost.
So I created
`/etc/spamexperts_domains` and I list a bunch of domain names in it like so:
```
example.com
test.com
blabla.com
```
And then I updated my `/etc/exim.routers.pre.conf` to:
```
smart_route_forward:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = ${if match_domain{$sender_address_domain}{lsearch;/etc/spamexperts_domains}}
# Exclude null sender messages from relaying via the smarthost
condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
transport = remote_smtp_forward_transport
route_list = $domain hostname::587
no_more
```
and my `/etc/exim.transports.pre.conf` with:
```
spamexperts_smarthost_transport:
driver = smtp
port = 587
hosts_require_tls = hostname
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}}
headers_add = "${perl{check_mail_permissions_headers}}"
```
Now the domain names sending emails that are NOT listed in `/etc/spamexperts_domains` are perfectly sending emails out via the default intended way, which is what I expect. However, the domain names that ARE listed in `/etc/spamexperts_domains` are now bouncing with the following:
```
recpientaddress@gmail.com
host hostname [hostname public IP]
SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1609:
550-Verification failed for <SRS0=2ede=qi=sendingdomain.com=example@gmail.com>
550-Called: 108.177.15.27
550-Sent: RCPT TO:<SRS0=2ede=qi=sendingdomain.com=example@gmail.com>
550-Response: 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-550-5.1.1 double-checking the recipient's email address for typos or
550-550-5.1.1 unnecessary spaces. For more information, go to
550-550 5.1.1 https://support.google.com/mail/?p=NoSuchUser ffacd0b85a97d-3789569a855si3111104f8f.494 - gsmtp
550 Invalid sender <srs0=2ede=qi=sendingdomain.com=example@gmail.com>
```
But I do not understand, I am sending a test email to `recpientaddress@gmail.com` from `[email protected]` but then the headers are changed oddly to some sort of forwarder, which I do not understand where it's coming from.
In any case, is what I have done above correct? I also want to reference documentation on this here:
- This is what I initially had in place: https://documentation.n-able.com/sp...vel/outgoing-filtering/exim-ip-based-auth.htm
- This is the method I want to use: https://documentation.n-able.com/sp.../outgoing-filtering/cpanel-whm-ip-auth-sd.htm
But as you can see, https://documentation.n-able.com/sp.../outgoing-filtering/cpanel-whm-ip-auth-sd.htm is related to cPanel, but I figured since both use Exim the configuration should be similar.
I would appreciate any feedback in this case.
I have been struggling to get this to work and I am not sure if what I am doing is correct. We use SpamExperts as our filtering server. We have currently configured all sending domain names to route emails via the smarthost by having the following in place In my `/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 = * hostname::587
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 = * hostname::587
no_more
````
And in my `/etc/exim.transports.pre.conf` I have the following:
```
spamexperts_smarthost_transport:
driver = smtp
port = 587
hosts_require_tls = hostname
```
This works 100% and is sending out emails, but as mentioned, its applying this route for ALL sending domain names. And instead, we want only specific domain names to pass via the smarthost.
So I created
`/etc/spamexperts_domains` and I list a bunch of domain names in it like so:
```
example.com
test.com
blabla.com
```
And then I updated my `/etc/exim.routers.pre.conf` to:
```
smart_route_forward:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = ${if match_domain{$sender_address_domain}{lsearch;/etc/spamexperts_domains}}
# Exclude null sender messages from relaying via the smarthost
condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
transport = remote_smtp_forward_transport
route_list = $domain hostname::587
no_more
```
and my `/etc/exim.transports.pre.conf` with:
```
spamexperts_smarthost_transport:
driver = smtp
port = 587
hosts_require_tls = hostname
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}}
headers_add = "${perl{check_mail_permissions_headers}}"
```
Now the domain names sending emails that are NOT listed in `/etc/spamexperts_domains` are perfectly sending emails out via the default intended way, which is what I expect. However, the domain names that ARE listed in `/etc/spamexperts_domains` are now bouncing with the following:
```
recpientaddress@gmail.com
host hostname [hostname public IP]
SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1609:
550-Verification failed for <SRS0=2ede=qi=sendingdomain.com=example@gmail.com>
550-Called: 108.177.15.27
550-Sent: RCPT TO:<SRS0=2ede=qi=sendingdomain.com=example@gmail.com>
550-Response: 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-550-5.1.1 double-checking the recipient's email address for typos or
550-550-5.1.1 unnecessary spaces. For more information, go to
550-550 5.1.1 https://support.google.com/mail/?p=NoSuchUser ffacd0b85a97d-3789569a855si3111104f8f.494 - gsmtp
550 Invalid sender <srs0=2ede=qi=sendingdomain.com=example@gmail.com>
```
But I do not understand, I am sending a test email to `recpientaddress@gmail.com` from `[email protected]` but then the headers are changed oddly to some sort of forwarder, which I do not understand where it's coming from.
In any case, is what I have done above correct? I also want to reference documentation on this here:
- This is what I initially had in place: https://documentation.n-able.com/sp...vel/outgoing-filtering/exim-ip-based-auth.htm
- This is the method I want to use: https://documentation.n-able.com/sp.../outgoing-filtering/cpanel-whm-ip-auth-sd.htm
But as you can see, https://documentation.n-able.com/sp.../outgoing-filtering/cpanel-whm-ip-auth-sd.htm is related to cPanel, but I figured since both use Exim the configuration should be similar.
I would appreciate any feedback in this case.