I have a mail server which has the primary MX record and this mail server handles all the mail inboxes and mail in and out of the mail boxes.
I setup a second mail server which doesn't have an MX record but is only acting as a server to send out mail only, no incoming mail is accepted. This second server is just to send mail out from a website that is load balanced across a few nodes and only the web server nodes have access to send mail out from this second mail server.
All the above is working great, the issue I have now is that when someone fills out a contact form on the website I send a mail to the user that submitted the form and I also send the contents of the form to a info email so the site is example.com and I send one of the mails to info@example.com, the problem here is that the email to info@example.com is handled locally on the server and I want it to be sent out externally from the second mail server like any other mail.
The mail server is mail2.example.com
.
Hope this makes sense.
main.cf
myhostname = mail2.example.com
mydomain = example.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
# Custom changes
message_size_limit = 10485760
mailbox_size_limit = 0
always_add_missing_headers = yes
# Server
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_cert_file = /etc/letsencrypt/live/mail2.example.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail2.example.com/privkey.pem
smtpd_tls_CApath = /etc/letsencrypt/live/mail2.example.com
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtpd_tls_mandatory_ciphers = high
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_tls_eecdh_grade = strong
# Client
smtp_tls_loglevel = 1
smtp_tls_security_level = may
smtp_tls_cert_file = /etc/letsencrypt/live/mail2.example.com/fullchain.pem
smtp_tls_key_file = /etc/letsencrypt/live/mail2.example.com/privkey.pem
smtp_tls_CApath = /etc/letsencrypt/live/mail2.example.com
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_mandatory_exclude_ciphers = MD5 , DES, ADH, RC4, SRP, 3DES, eNULL
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtp_tls_protocols = !SSLv2,!SSLv3
smtp_tls_mandatory_ciphers = high