Requirements
So what will you need? Not to much. All that you need to set it up is working Postfix server (we will make changes in it’s configuration file) and external e-mail account with SMTP access (probably 99% of e-mail account will be ok, for ex. Gmail). So if you want to send emails with external (relay your mail). Here is a quick howto.
Step 1: Edit your configuration file
You will need to make changes in your configuration file (in standard postfix configuration it would be /etc/postfix/main.cf). You need to add at the end of configuration file following lines:
relayhost = smtp.provider.com:25 smtpd_sasl_auth_enable = yes smtpd_sasl_path = smtpd smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_type = cyrus smtp_sasl_auth_enable = yes # optional: necessary if email provider uses load balancing and # forwards emails to another smtp server # for delivery (ie: smtp.yahoo.com --> smtp.phx.1.yahoo.com) smtp_cname_overrides_servername = no # optional: necessary if email provider # requires passwords sent in clear text smtp_sasl_security_options = noanonymous |
Step 2: Generate password file
Postfix have to know your account login and password as most SMTP servers would not allow to rely emails from unauthorized connections. You will need to make a password file “/etc/postfix/sasl_passwd” with similar content:
# The server info must exactly match the value # for "relayhost" in /etc/postfix/main.cf smtp.provider.com:25 username:password |
$ postmap hash:/etc/postfix/sasl_passwd |
$ postmap -q smtp.provider.com:25 /etc/postfix/sasl_passwd |
You can remove “/etc/postfix/sasl_passwd“. POSTFIX will not need it anymore.
It should be working now! Restart your POSTFIX and test it! If you have any problems please make a comment below. I will try to help you.
No comments:
Post a Comment