# Interesting Topics in Email

**URL:** <https://www.ruby-forum.com/t/interesting-topics-in-email/152170>\
**Category:** Rails\
**Created:** [October 30, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/interesting-topics-in-email/152170 "2008-10-30T19:25:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 30, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/interesting-topics-in-email/152170/1 "2008-10-30T19:25:01Z")

</div>

I have a dream email system that I’d like to set-up. Well, actually,  
I’ve already set it up, but I’ve got a few questions to ask and there’s  
also some limitations that I’d like to work through.

I think that this topic might be helpful for lots of other folks 'cause  
my dream system seems like it’s the same system that anyone with a  
public-facing web application might like to have.

My dream email system has two purposes:

Purpose 1. General Purpose Corporate Email (all email addresses except  
“removed\_email\_address@domain.invalid”) – employee email, responding manually to users  
with support questions, etc. For this I’ve set-up gmail for my domain  
and I’ve set up an MX record at my domain registrar (1and1) directing it  
to use gmail as my mailserver.

Purpose 2. Automated Interaction with My Users (email address  
“removed\_email\_address@domain.invalid”) – sending password reset, sending welcome email  
when new account established, bulk email to all of my users who “opt in”  
to bulk communication, etc. For this I’m using ActionMailer and the  
sendmail program on my server (this bypasses gmail).

It’s all up and working but I’ve got a few questions.

Question 1. What is the performance threshhold for a bulk email using  
sendmail? I haven’t hit it yet but my largest email has gone out to 500  
recipients. What if I sent an email to 10,000 recipients? Will it send  
or will it break? I’d rather anticipate this problem now rather than  
find out about it later.

Question 2. It seems like right now sending my Purpose 2 email is  
invisible to google. That is, 1and1 isn’t telling google that I’m  
bypassing them and sending some of my email with sendmail. That’s the  
way I want it and I hope that’s actually true. Is it? I don’t want to  
get google mad at me 'cause I’m sending bulk emails that are touching  
their system when I don’t intend to.

Question 3. My Purpose 2 setup has a problem in that delivery errors  
are not posted back to ActionMailer. Rather, 1and1 uses the MX record  
to divert the delivery errors to my gmail account. An example: sendmail  
sends a Purpose 2 email to “removed\_email\_address@domain.invalid” from  
“removed\_email\_address@domain.invalid” and the bounceback is directed by the 1and1 MX  
record to gmail. Is this confusing to gmail since gmail didn’t send the  
message to begin with? Are they going to get mad at me? The best  
solution would be to have two MX records for my domain – a Purpose 1 MX  
record directing to gmail and a Purpose 2 record directing to  
ActiveRecord/sendmail. However, 1and1 tells me that they can’t have  
multiple MX records for one domain.

Question 4. Given its limitations, my solution really seems like a bad  
one. What is the right way (the Ruby Way? :)) to handle Purpose 1 and  
Purpose 2 email? Some ideas:

Idea 1. Set up a second domain “[mysitemail.com](http://mysitemail.com)” and build a  
corresponding second rails app which handles Purpose 2 email. In that  
case, how could I configure my orginal rails app “[mysite.com](http://mysite.com)” to send  
mail through “[mysitemail.com](http://mysitemail.com)” rather than through itself? Is this a  
good idea? Note that this is not optimal in that my users would get  
email from a confusing second site.

Idea 2. Find a domain registrar that allows multiple MX records? Does  
anyone know of anyone?

How have other folks handled all of this?

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 31, 2008, 2:26pm UTC](https://www.ruby-forum.com/t/interesting-topics-in-email/152170/2 "2008-10-31T14:26:39Z")

</div>

John C. wrote:

> Idea 2. Find a domain registrar that allows multiple MX records? Does  
> anyone know of anyone?

Multiple MX records are only of use when the primary MX is unvailable.  
There are no external routing options other than at the domain level or  
subdomain level - you can create [junk.mysite.com](http://junk.mysite.com) and have a separate MX  
to [mysite.com](http://mysite.com)’s.

Personally I would also use qmail for your outgoing mail also.

I’m not sure where google come into this ?

If you are not using a smart relay the delivery errors will be generated  
by your mail server so they will never go near the internet.

```
                                                          I'd bin

```

them personally and scan mail logs for failures. Bounces should only  
occur in the event of a destination mail server accepting the email  
first and for some reason failing to deliver it itself. This shouldn’t  
occur that often as most (good) mail servers will reject during the  
email delivery attempt - which does not generate a bounce - though your  
mail server will subsequently inform you via email of the failure to  
deliver it will log it also (qmail does anyhow).

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 31, 2008, 2:46pm UTC](https://www.ruby-forum.com/t/interesting-topics-in-email/152170/3 "2008-10-31T14:46:17Z")

</div>

Thanks Andrew.

I will take a look at qmail – I hadn’t even heard of it before.

Google is involved because I really like the gmail system for my  
corporate email. They have excellent spam-fighting, and well, gmail is  
just the best in my opinion.

I’ve been investigating the following system:

## Incoming Mail

Internet →   
Domain Host ([1and1.com](http://1and1.com)) Mx Records →   
Some kind of router on my domain (sendmail or qmail??) →   
if (mail to removed\_email\_address@domain.invalid)  
(route mail to sendmail/ActionMail on my domain)  
else  
(route mail to gmail using gmail’s Mx records)  
end

The key thing is that all incoming mail is routed to my domain which  
then bounces the relevant mail to gmail.

What is the best program / method to check incoming email’s “to” address  
and route the email accordingly?

Is this a reasonable thing to do?

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 31, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/interesting-topics-in-email/152170/4 "2008-10-31T15:19:05Z")

</div>

John C. wrote:

> Question 1. What is the performance threshhold for a bulk email using  
> sendmail? I haven’t hit it yet but my largest email has gone out to 500  
> recipients. What if I sent an email to 10,000 recipients? Will it send  
> or will it break? I’d rather anticipate this problem now rather than  
> find out about it later.

I can’t answer your question, but I had the same question earlier this  
year. I decided to send the email to groups of N users at a time.

Peace.

---

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 31, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/interesting-topics-in-email/152170/5 "2008-10-31T15:00:08Z")

</div>

John C. wrote:

> Is this a reasonable thing to do?

Is this a personal thing or a service that other people will be using ?  
If the latter - run your own mail server. If the former - run your  
own mail server 😉 I really don’t see any credibility in routing email  
via google.

If SPAM is an issue run ASSP in front of your mail server - it rocks.
