May 30, 2008

Mail sending from EC2 using Postfix.

One of the main problem I found in the EC2 is to sending mail to outside world. Some mail servers like YAHOO and HOTMAIL will block all the orphan mails from EC2 as SPAM. So people cannot send mail like CustomerVerification,NewsLetter from EC2 comfortably.So I am hereby stating an alternate method which was experimented by Paul to get out of this problem. This is sending mails using POSTFIX

Scenario
1.Amazon EC2
2.Customised AMI from FC4

HowTo

1.Stop Sendmail
#/etc/init.d/sendmail stop
#chkconfig --levels 2345 sendmail off

2.Installing Postfix
#yum -y install postfix

3.Editing the /etc/postfix/main.cf
#vi /etc/postfix/main.cf

myhostname = www.YOURDOMAIN.com
mydomain = YOURDOMAIN.com
myorigin = $mydomain

smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = no

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localdomain, localhost, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +

# SECURITY NOTE: Listening on all interfaces. Make sure your firewall is
# configured correctly
inet_interfaces = all

relayhost = [mail.authsmtp.com]
smtp_connection_cache_destinations = mail.authsmtp.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:YOUR_AUTHSMPT_USER_ID:YOUR_AUTHSMTP_PW
smtp_sasl_security_options = noanonymous

default_destination_concurrency_limit = 4

soft_bounce = yes

4.Save and Exit
5.Start the Postfix
#/etc/init.d/postfix start
6.Check whether master is listening or not
#ps -ef | grep master

Enjoy Mailing from EC2 without trouble

2 comments:

Frederick Vallaeys said...

very helpful article. It helped me get my mail on Amazon EC2 running.

Unknown said...

Thanks much!
you saved the day!..

thanks for sharing the info.. was useful to me.