Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on สิงหาคม 07, 2018, 09:40:55 PM

Title: postfix mail configure relaymail host to send email via mailgun
Post by: golfreeze on สิงหาคม 07, 2018, 09:40:55 PM
sudo apt-get update
sudo apt-get install postfix libsasl2-modules -y

###re-configure postfix
dpkg-reconfigure postfix
and choose “Internet-site”

###edit to use sasl
vi /etc/postfix/main.cf

# specify SMTP relay host
relayhost = [mail.isp.example]
# 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


#vi /etc/postfix/sasl_passwd
Add the following line to the new file:
/etc/postfix/sasl_password
smtp.mailgun.org your_mailgun_smtp_user@your_subdomain_for_mailgun:your_mailgun_smtp_password

Next, protect the file by restricting read and write permissions to root and and use the postmap command to update Postfix's lookup tables to use this new file:
#chmod 600 /etc/postfix/sasl_passwd
#postmap /etc/postfix/sasl_passwd

###Restart service postfix
/etc/init.d/postfix restart