Skip to content

Instantly share code, notes, and snippets.

@douglascrp
Last active July 27, 2022 13:53
Show Gist options
  • Save douglascrp/d08b2ded5b9a29c3a91c8b909d66df59 to your computer and use it in GitHub Desktop.
Save douglascrp/d08b2ded5b9a29c3a91c8b909d66df59 to your computer and use it in GitHub Desktop.
Install and configure postfix on ubuntu
flowable.mail.server.host=localhost
flowable.mail.server.port=25
flowable.mail.server.username=email
flowable.mail.server.password=password
flowable.mail.server.default-from=email
Install Packages
# apt update
# apt install postfix mailutils -y
When asked, select "Satellite system"
Setup postfix and password database
# vim /etc/postfix/sasl_passwd
Insert the line
[smtp.mymail.com]:25 user@mymail.com:mysecretpassword
# postmap /etc/postfix/sasl_passwd
# ls -l /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
# rm /etc/postfix/sasl_passwd
# vim /etc/postfix/main.cf
# specify SMTP relay host
relayhost = [smtp.mymail.com]:587
# enable SASL authentication
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
## for office 365
smtp_use_tls = yes
mydestination = $mydomain, localhost.$mydomain, localhost
# service postfix restart
Testing Your Postfix Configuration
echo "body of your email" | mail -s "This is a subject" -a "From: you@example.com" recipient@elsewhere.com
Logs
/var/log/mail.log
Mail queue
mailq
Reprocess queue
postqueue -f
https://www.masterkenneth.com/2018/08/configuring-postfix-relay-for-mail-sending-ubuntu-16-04/
https://www.linode.com/docs/guides/postfix-smtp-debian7/
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment