Recently I was working on setting up SMTP Authentication to send mails through there ISP's mail server.
I first tried with perl MIME::Lite program which i found very hard to work with SMTP Authentication. So I decided to configure Postfix to relay mails to ISP mail server ( with SMTP Authentiction).
Postfix main configuration file: /etc/postfix/main.cf
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost, localhost.localdomain, localhost
relayhost = smtp.isp.com
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth ## **
smtp_sasl_security_options = noanonymous
To check postfix config.
#postfix check
#postconf
** smtp_auth is the file we store Authentication information
smtp.isp.com sheeju@isp.com:mypassword
smtp_auth is in this format
*** - Depending on your provider this can be username or useremail.
Next create hash DB of smtp_auth.
#postmap hash:/etc/postfix/smtp_auth
otherwise you get the error..
postfix/smtp[nnnnn]: fatal: open database /etc/postfix/smtp_auth.db: No such file or directory
Restart Postfix
# /etc/init.d/postfix restart
Testing Postfix:
echo testing | mail -s Bla sheejuec7@gmail.com
This is used to send test mail to sheejuec7@gmail.com. Next to check whether the mail relayed through ISP use
mailq
tail /var/log/mail.log
Two Highly Recommended Books
4 years ago
1 comment:
Thank You so much!)))
it's usefull command
postmap hash:/etc/postfix/smtp_auth
Post a Comment