1. Install Postfix
Installed by default on Ubuntu. On centos, I di the yum install postfix before I did the yum remove sendmail as it meant yum wouldnt try to remove a whole bunch of stuff where an MTA is a dependancy.
2. Configure mail relaying
add the following to /etc/postfix/main.cf
relayhost = smtp.midco.net
Midco also require you to authenticate before it will receive mail. So you need to add the following. You also need to tell postfix a username and password - we'll see that later.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=
Next, midco rejects mail with a bad from address. So, you need to masqquerade all outgoing mail. Add this to /etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic
3. Edit /etc/postfix/sasl_passwd
Put your midco mail username and password in here. Use the following format:
relayhost username:passwordso it should look something like this:
smtp.midco.net your.mailbox@bis.midco.net:yourmailboxpassword
4. Edit /etc/postfix/generic
Here you make a list of what you want to masquerade from and to. So, we want everything going out to look like it is part of the midco happy family. I solved this problem for a trixbox installation, so my file looked like this:
@asterisk1.local my.mailbox@bis.midco.net
This tells postfix to replace anthing from the host asterisk1.local (which is the trixbox) with my midco email address. It may look confusing to the recipient, which is unfortunate. You may be able to mess with the bit before the @ sign, but the stuff after has to be a proper domain name.
5. Make these files readable by postfix.
You need to encode the files you have just created.
postmap /etc/postfix/sasl_passwdYou should now see /etc/postfix/sasl_passwd.db and /etc/postfix/generic.db
postmap /etc/postfix/generic
6. Secure your files.
There are passwords in plaintext, so lets secure them.
chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
7. Restart Postfix and test.
/etc/init.d/postfix restart
Now send an email somewhere. Watch the logs in /var/log/maillog. All being well, the mail should sail on through the mail system.
No comments:
Post a Comment