Tuesday, March 8, 2011

Relaying mail for internal server

Having a running staging server would be nice to test application before putting it live.
But since most of us in malaysia is on Streamyx or Unifi, the port25 has been blocked.

One way to solve it is to ask the smtp server to relay mail to an external mail server.
But will require a valid loginid and password of an email account to do so.

If you are using sendmail, you may do setup this way:
1. Find “DS” in /etc/mail/sendmail.cf and add your mail server name as below: -
DSmail.yourdomain.com

2. Find “Mrelay” in /etc/mail/sendmail.cf and add “587″ to “A=TCP $h”.
This port represent your external mail smtp port, since port 25 is blocked:
A=TCP $h 587

3. Add the following line below in /etc/mail/access file in one line: -

AuthInfo:mail.yourdomain.com "U:user@yourdomain.com" "I:user@yourdomain.com" "P:youremailpassword" "R:yourdomain.com" "M:LOGIN PLAIN"

4. Then, restart your Sendmail service as below: -

service sendmail restart

4. Finally, you can monitor your maillog using the command below: -

tail -f /var/log/mail.log

No comments: