sending and receiving emails from EC2?

292 views
Skip to first unread message

Christopher Gill

unread,
Oct 25, 2007, 2:14:09 PM10/25/07
to ec2-on-rai...@googlegroups.com
Does anyone have suggestions for sending and receiving emails on EC2?  Playing around with sendmail last night I was able to rails to use it to send emails to my gmail account from EC2 but they showed up in the spam folder.  From reading the AWS forums it looks like other email providers like hotmail and yahoo would flat out reject those emails.  While I haven't tried it yet, it seems like you could get your MX record pointing to your EC2 instance - but from the forums, this won't fix all of your spam issues as the dynamic nature of the EC2 IP block causes some servers to mark any emails from that range as spam, whether the DNS resolves or not.  Also if your instance goes down, there would be a period where mail was either undeliverable or getting erroneously delivered to somebody else's instance due to cached DNS lookups and the high TTL of MX records...

So does anyone have experience running a working reliable email server on EC2 and have pointers they can share?  If not, does anyone recommend any other services?  I saw that some people are using authsmtp.com to send emails - that looks like it would work for sending but I need to receive (and process) emails as well.  Somebody recommended fastmail.fm for receiving but they force you to choose email addresses at one of their domain names which I don't want to do. 

Also worth mentioning is Google Apps for email - they mailbox size is enormous (25GB at last check) but supposedly there is a 500 emails outbound per day limit that people are hitting - which is way too low.

This seems to be my last missing piece of the EC2 puzzle - but it's a pretty important piece to be able to send confirmation emails and respond to customer support requests!

Apologies for this being slightly off-topic for this list, but if we do figure something out here I'd imagine we'll want to roll it into the AMI to make everyone's life a weee bit easier.

Thanks,
Chris

Alex MacCaw

unread,
Oct 25, 2007, 3:00:55 PM10/25/07
to ec2-on-rai...@googlegroups.com
I suppose you could use google apps for you domain if you had multiple accounts.
It works out much cheaper than authsmtp (especially if you use the free version ;) ).
Does anyone know what windows live for you domain is like? Does it have an email limit?
Alex
--
http://www.eribium.org | http://juggernaut.rubyforge.org | http://www.aireofs.com | Skype: oldmanorhouse

Paul Dowman

unread,
Oct 25, 2007, 3:32:51 PM10/25/07
to ec2-on-rai...@googlegroups.com
Because of the arbitrary nature of many spam filters, I think it's best to relay outgoing mail through a good smtp provider. I did everything I could to send directly from an EC2 instance, but some receivers always marked the messages as spam. I think it's because of the dynamic IP address range in EC2, as you mentioned. I'd think that a valid SPF record should cause the receiver to trust your IP address, but it doesn't seem to work that way for some.

I'm using EasyDNS to relay outgoing mail, and I'm really happy with the service. It's super fast, and my mail generally gets through spam filters (so far... I'm not sending a large volume yet). I do have an SPF record that allows their smtp server. It's not featured on their site yet, they just started offering it, but they do 2000 emails/day for $250/year, and they have larger plans also.

I don't recommend relaying outbound mail through Google Apps, they supposedly have a 500 messages/day limit, according to many people on their forums, but I couldn't find that published anywhere. Also, I think they rewrite the sender address, so you can't send from an arbitrary email address, in case you want to do that (I don't anyway).

You should have no problem receiving mail to an EC2 instance, if you really want to do that. Personally I use Google apps for receiving.

I prefer postfix rather than sendmail though, it's much easier to configure. On my app server instances I deliver to a local postfix which relays through the easydns smtp server. That way the mongrel instance doesn't wait as long and there's less that can go wrong. If there's a problem with the remote server the mail will be queued locally by postfix. I can share my postfix config file if anyone wants it.

Paul

David Pratt

unread,
Oct 25, 2007, 4:20:19 PM10/25/07
to ec2-on-rai...@googlegroups.com
Hi Paul, I'd appreciate seeing your postfix config. This may be useful
generally and I have been thinking of relaying thru DNSMadeEasy. Many
thanks.

Regards,
David

Paul Dowman wrote:
> Because of the arbitrary nature of many spam filters, I think it's best
> to relay outgoing mail through a good smtp provider. I did everything I
> could to send directly from an EC2 instance, but some receivers always
> marked the messages as spam. I think it's because of the dynamic IP
> address range in EC2, as you mentioned. I'd think that a valid SPF
> record should cause the receiver to trust your IP address, but it
> doesn't seem to work that way for some.
>

> I'm using EasyDNS <http://support.easydns.com/outbound_smtp.php> to

> relay outgoing mail, and I'm really happy with the service. It's super
> fast, and my mail generally gets through spam filters (so far... I'm not
> sending a large volume yet). I do have an SPF record that allows their
> smtp server. It's not featured on their site yet, they just started
> offering it, but they do 2000 emails/day for $250/year, and they have
> larger plans also.
>
> I don't recommend relaying outbound mail through Google Apps, they
> supposedly have a 500 messages/day limit, according to many people on
> their forums, but I couldn't find that published anywhere. Also, I think
> they rewrite the sender address, so you can't send from an arbitrary
> email address, in case you want to do that (I don't anyway).
>
> You should have no problem receiving mail to an EC2 instance, if you
> really want to do that. Personally I use Google apps for receiving.
>
> I prefer postfix rather than sendmail though, it's much easier to
> configure. On my app server instances I deliver to a local postfix which
> relays through the easydns smtp server. That way the mongrel instance
> doesn't wait as long and there's less that can go wrong. If there's a
> problem with the remote server the mail will be queued locally by
> postfix. I can share my postfix config file if anyone wants it.
>
> Paul
>
>

> On 10/25/07, *Alex MacCaw* <mac...@gmail.com

> <mailto:mac...@gmail.com>> wrote:
>
> I suppose you could use google apps for you domain if you had
> multiple accounts.
> It works out much cheaper than authsmtp (especially if you use the
> free version ;) ).
> Does anyone know what windows live for you domain is like? Does it
> have an email limit?
> Alex
>

> On 10/25/07, *Christopher Gill* < gill...@gmail.com


> <mailto:gill...@gmail.com>> wrote:
>
> Does anyone have suggestions for sending and receiving emails on
> EC2? Playing around with sendmail last night I was able to
> rails to use it to send emails to my gmail account from EC2 but
> they showed up in the spam folder. From reading the AWS forums
> it looks like other email providers like hotmail and yahoo would
> flat out reject those emails. While I haven't tried it yet, it
> seems like you could get your MX record pointing to your EC2
> instance - but from the forums, this won't fix all of your spam
> issues as the dynamic nature of the EC2 IP block causes some
> servers to mark any emails from that range as spam, whether the
> DNS resolves or not. Also if your instance goes down, there
> would be a period where mail was either undeliverable or getting
> erroneously delivered to somebody else's instance due to cached
> DNS lookups and the high TTL of MX records...
>
> So does anyone have experience running a working reliable email
> server on EC2 and have pointers they can share? If not, does
> anyone recommend any other services? I saw that some people are

> using authsmtp.com <http://authsmtp.com> to send emails - that


> looks like it would work for sending but I need to receive (and
> process) emails as well. Somebody recommended fastmail.fm

> <http://fastmail.fm> for receiving but they force you to choose

Christopher Gill

unread,
Oct 25, 2007, 4:41:51 PM10/25/07
to ec2-on-rai...@googlegroups.com
Paul,

Thanks for the suggestions - I think you must have jinxed easyDNS because I can't get their site to load now!  Regarding Google Apps, I was reluctant to use that to receive mail because I need an automated process checking/downloading/processing emails in my inbox and I read somewhere on the Google Apps site (of course I can't find it now..) that they could arbitrarily suspend any accounts for checking too frequently or in an automated fashion or something to that effect.  Since I can't find anything about that limitation any more I think I'll give the Premier Edition a shot - considering the amount of storage $50/year gets you, plus the top-notch spam filtering, that's probably the way to go.

Thanks,
Chris

Paul Dowman

unread,
Oct 25, 2007, 6:17:29 PM10/25/07
to ec2-on-rai...@googlegroups.com
OK, here it is. It works for me, but I'm not exactly a postfix guru so double-check everything in here yourself. In particular, I haven't tested anything security-related because I have port 25 blocked by the firewall, it's only accessible from the mongrel instance on the same host.

It doesn't use TLS, but it really should to protect the password.

myhostname = www.yourdomain.com
mydomain = yourdomain.com
myorigin = localhost

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 = +
inet_interfaces = all

relayhost = [ mailout.easydns.com]
smtp_connection_cache_destinati
ons = mailout.easydns.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:your_smtp_userid:your_smtp_password
smtp_sasl_security_options = noanonymous

David Pratt

unread,
Oct 26, 2007, 11:26:43 PM10/26/07
to ec2-on-rai...@googlegroups.com
Many thanks Paul. This gives me a starting point.

Regards
David

Paul Dowman wrote:
> OK, here it is. It works for me, but I'm not exactly a postfix guru so
> double-check everything in here yourself. In particular, I haven't
> tested anything security-related because I have port 25 blocked by the
> firewall, it's only accessible from the mongrel instance on the same host.
>
> It doesn't use TLS, but it really should to protect the password.
>

> myhostname = www.yourdomain.com <http://www.yourdomain.com/>
> mydomain = yourdomain.com <http://yourdomain.com/>


> myorigin = localhost
>
> 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 <http://127.0.0.0/8>


> mailbox_size_limit = 0
> recipient_delimiter = +
> inet_interfaces = all
>

> relayhost = [ mailout.easydns.com <http://mailout.easydns.com/>]
> smtp_connection_cache_destinati
> ons = mailout.easydns.com <http://mailout.easydns.com/>


> smtp_sasl_auth_enable = yes
> smtp_sasl_password_maps = static:your_smtp_userid:your_smtp_password
> smtp_sasl_security_options = noanonymous
>
>

> On 10/25/07, *David Pratt* <fair...@eastlink.ca

> > <mailto: mac...@gmail.com <mailto:mac...@gmail.com>>> wrote:
> >
> > I suppose you could use google apps for you domain if you had
> > multiple accounts.
> > It works out much cheaper than authsmtp (especially if you
> use the
> > free version ;) ).
> > Does anyone know what windows live for you domain is like?
> Does it
> > have an email limit?
> > Alex
> >
> > On 10/25/07, *Christopher Gill* < gill...@gmail.com
> <mailto:gill...@gmail.com>

Paul Dowman

unread,
Mar 3, 2008, 9:26:17 PM3/3/08
to ec2-on-rai...@googlegroups.com
I'm reviving this thread because I recently posted my mail setup on my blog, it might be helpful to some people on this list:

http://pauldowman.com/2008/02/17/smtp-mail-from-ec2-web-server-setup/

Paul
--
http://pauldowman.com

David Pratt

unread,
Mar 3, 2008, 11:30:58 PM3/3/08
to ec2-on-rai...@googlegroups.com
Hi Paul. I read your blog post about a week ago. It's a very good
article and extremely helpful to anyone attempting to make use of ec2.
Thank you for documenting this so well.

Regards,
David

> > <mailto:mac...@gmail.com <mailto:mac...@gmail.com>>> wrote:
> >
> > I suppose you could use google apps for you domain if you had
> > multiple accounts.
> > It works out much cheaper than authsmtp (especially if you
> use the
> > free version ;) ).
> > Does anyone know what windows live for you domain is like?
> Does it
> > have an email limit?
> > Alex
> >
> > On 10/25/07, *Christopher Gill* < gill...@gmail.com
> <mailto:gill...@gmail.com>

Reply all
Reply to author
Forward
0 new messages