Last active
March 23, 2022 16:52
-
-
Save wnasich/71093e406c07ed3f03f63da8abd6ce97 to your computer and use it in GitHub Desktop.
Install outgoing email from Debian/Ubuntu system through SendGrid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt install postfix mailutils | |
# Choose host type 'No configuration' | |
$ sudo cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf | |
$ sudo vi /etc/postfix/main.cf | |
# Add lines below | |
smtp_sasl_auth_enable = yes | |
smtp_sasl_password_maps = static:apikey:paste_your_key_here | |
smtp_sasl_security_options = noanonymous | |
smtp_tls_security_level = encrypt | |
header_size_limit = 4096000 | |
relayhost = [smtp.sendgrid.net]:587 | |
# Redirect root emails to real email address | |
$ sudo vi /etc/aliases | |
root: [host]_postfix@[your domain] | |
$ sudo service postfix restart | |
# Check logs | |
$ tail -f /var/log/mail.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment