How do I setup SMTP Relay?

Question - is it possible to route mail to an external relay server for specific domains only, while the remaining domains are handled by the localhost?
 
Yes, wel l it took me a long time to figure out but yes it is possible:

We use spamexperts as external spam platform and we use their local cloud solution
We have a exim mod for incoming mail to decline the mail and give the message to deliver the message to the MX-records. (when the mx records are set and the spammer try's to connect directly to the webservers smtp port). And we have the same for outgoing, here are the quick mods for outgoing:

outgoing:

exim.conf mods, follow the instructions and change the externalrelayserver.com and the optional outgoing portnumber like 587 to 25 or 465 etc

# at the define locallists add the following
# in this list you will place all outgoing domains for a specific domain that need to go thrue a specific external relay.

##nr1net-edit-1
domainlist spamexperts_domainsout = lsearch;/etc/virtual/spamexperts_domainsout
##

# do not forget to create the files, with the correct permissions
#touch /etc/virtual/spamexperts_domainsout
#chmod 644 /etc/virtual/spamexperts_domainsout

#at the authenticators section add this if you need authentication for the outgoing relay

##nr1net-edit-3
## uncomment the # when you want to use user based authentication
#spamexperts_login:
# driver = plaintext
# public_name = LOGIN
# client_send = : [email protected] : password
##

#at begin routers you add: (before the lookuphost)
# you could add multiple of these routers with different lists just make sure its above the no_more section

##nr1net-edit-4
spamexperts_smarthost_router:
driver = manualroute
domains = ! +local_domains
# manual test
# senders = ^.*@domain.com
# file lookup
senders = *@partial-lsearch;/etc/virtual/spamexperts_domainsout
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
transport = spamexperts_smarthost_transport
route_list = * externalrelayserver.com::587
##

(the lookuphost: will have the statement no_more and will stop processing)

#above remote_smtp: you add the following and uncomment the hosts_require_auth if you need outgoing authentication

##nr1net-edit-5
#nr1netoutgoing
spamexperts_smarthost_transport:
driver = smtp
hosts_require_tls = externalrelayserver.com
## uncomment this if you want to user userid based authentication instead of ip based
# hosts_require_auth = *
##
 
Ancient thread even, please don't do this, we know where to find the docs. It's not appreciated.
It would have helped me as I was searching for the answer. Found this thread a long time before that docs page showed up in my search results.
 
It would have helped me as I was searching for the answer.
One can always check the docs first when one is looking for something. It's just not done to up a 9 year old thread to only point to the docs, where one should look in to begin with. One can also search for docs. :)
There is whole lot changed in 9 years, which is why it's best not to up that kind of old threads.;)
 
Back
Top