smarthost
April 26, 2017
🔗Smarthost with postfix
A smart host is a type of email message transfer agent that allows a Simple Mail Transfer Protocol (SMTP) server to route email to an intermediate mailserver rather than directly to the recipient's server
https://en.wikipedia.org/wiki/Smart_host
Setup postfix to forward all emails using an external SMTP server, for example
sendgrid.net, main.cf
:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:username:password
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
Within a VPC or private network you can open relay to all your class:
mynetworks_style = class
Some tunings:
smtp_connect_timeout = 5
smtp_helo_timeout = 5
disable_dns_lookups = yes
To check list of queued mail:
postqueue -p