Best way to mass mail

127 views
Skip to first unread message

MajorProgamming

unread,
Dec 18, 2008, 7:00:40 PM12/18/08
to Google App Engine
Suppose one of the features I have on the App I'm creating, is the
ability for users to subscribe for certain "alerts."

1. What would be the best way to implement this considering the
current features available on google app engine (and possibly other
free services)?

2. [this one should probably be answered by a google employee:] Is
this type of functionality ever going to be fully supported by app
engine?

Alexander Kojevnikov

unread,
Dec 18, 2008, 7:43:52 PM12/18/08
to Google App Engine
> Suppose one of the features I have on the App I'm creating, is the
> ability for users to subscribe for certain "alerts."
>
> 1. What would be the best way to implement this considering the
> current features available on google app engine (and possibly other
> free services)?
>
There are two issues to consider:

* Calling send_mail() takes time, don't send too many emails in one
request.
* If you send too many emails within a short period of time you will
get a quota exceeded error, even if you don't reach your daily email
quota.

What I do in my app is the following:

* I ping a certain URL from an external box.
* The handler of that URL sends one pending email.
* Wait, rinse, repeat. Time to wait (in seconds) = 24 * 60 * 60 /
daily_quota.

--
www.muspy.com

MajorProgamming

unread,
Dec 18, 2008, 9:31:15 PM12/18/08
to Google App Engine
That would work well for a small amount of users. But what if my app
grows to like 5,000 emails? Your solution would definitely work well
at that point!

Do you maybe know of an external service that would allow me to set up
s/t to "broadcast" to many url's or is there another way that i'm
"missing"?

On Dec 18, 7:43 pm, Alexander Kojevnikov <alexan...@kojevnikov.com>
wrote:

MajorProgamming

unread,
Dec 18, 2008, 9:33:59 PM12/18/08
to Google App Engine
Whoops, typo: I meant: Your solution would definitely _not_ work well
at that point!

Alexander Kojevnikov

unread,
Dec 18, 2008, 9:50:04 PM12/18/08
to Google App Engine
> That would work well for a small amount of users. But what if my app
> grows to like 5,000 emails? Your solution would definitely not work
> well at that point!
>
I agree that it's far from being perfect, but I don't see why it
wouldn't scale. I currently send about 100 emails a day, if this
number grows, I would just need to buy more quota and ping the mail
sender URL more frequently (every 17 seconds for 5,000 emails a day).

> Do you maybe know of an external service that would allow me to set up
> s/t to "broadcast" to many url's or is there another way that i'm
> "missing"?
>
Google will eventually roll out a solution for background processing,
you can switch to it when it's available.

Also, a few workarounds have been discussed in this group, just search
it for "background".

--
www.muspy.com

MajorProgamming

unread,
Dec 18, 2008, 10:28:39 PM12/18/08
to Google App Engine
Well another point is that if I want to send time-sensitive info, it
would be impossible (i.e. with your method, you are running the
sending throughout the entire day, but in some cases almost-instant
sending is required).

Another problem worth mentioning is that mass-fetching from the
datastore (all the emails) would not work in the current appengine...

On Dec 18, 9:50 pm, Alexander Kojevnikov <alexan...@kojevnikov.com>
wrote:

Alexander Kojevnikov

unread,
Dec 19, 2008, 12:04:18 AM12/19/08
to Google App Engine
> Well another point is that if I want to send time-sensitive info, it
> would be impossible (i.e. with your method, you are running the
> sending throughout the entire day, but in some cases almost-instant
> sending is required).
>
If you need to notify a lot of users on the same event instantly, then
yes - that's a bit of a problem. If however the events are personal,
that is if you need to notify only a handful of users on each event,
then your maximum delay is the interval between your pings multiplied
by the number of users to notify.

> Another problem worth mentioning is that mass-fetching from the
> datastore (all the emails) would not work in the current appengine...
>
I probably miss something but why do you need mass-fetching? What I do
in the mailer handler is fetching one "pending" entity, send the
email, and reset the "pending" flag from the entity. If there are no
"pending" entities, I just quit and wait for the next ping.

Greg

unread,
Dec 19, 2008, 5:33:13 AM12/19/08
to Google App Engine
On Dec 19, 1:00 pm, MajorProgamming <sefira...@gmail.com> wrote:
> 1. What would be the best way to implement this considering the
> current features available on google app engine (and possibly other
> free services)?

There are numerous (non-spam) mas mailing services, but no free ones
that I know of. Mass mailing is actually quite hard work, which is why
you have to pay for this. Unless you own a botnet of course...

MajorProgamming

unread,
Dec 19, 2008, 3:50:35 PM12/19/08
to Google App Engine
Why is it "hard work", from my understanding it simply requires
sending an email to X amount of people.

I could probably set up a PHP script to do this rather quickly...

The specific problem with Google App Engine is that there are
excecution time / cpu limits (per request), and there are also email
limits (2000 per day).

David Symonds

unread,
Dec 19, 2008, 7:32:02 PM12/19/08
to google-a...@googlegroups.com
On Fri, Dec 19, 2008 at 1:31 PM, MajorProgamming <sefi...@gmail.com> wrote:

> That would work well for a small amount of users. But what if my app

> grows to like 5,000 emails? Your solution would definitely [not] work well
> at that point!

App Engine is first and foremost a scalable web application system.
Sending large amounts of email is not its primary mission, so you
might want to go looking for a different provider for large volumes of
email. That might change one day, though.


Dave.

Barry Hunter

unread,
Dec 19, 2008, 8:57:39 PM12/19/08
to google-a...@googlegroups.com
2008/12/19 MajorProgamming <sefi...@gmail.com>:
>
> Why is it "hard work", from my understanding it simply requires
> sending an email to X amount of people.
>
> I could probably set up a PHP script to do this rather quickly...

but that script is almost certainly hiding a lot of the complexity
(like the AppEngine API does)

preparing and starting a message on its journey is a very small part.
Once the mail has passed from the application it needs to enter the a
mail queue (of some sort) and from there be sent on its way. That
involves looking up the relevent mail server and sending it on. But a
big part of it is dealing with when that server is down, or otherwise
unavailable, or simply refuses your email, you either need to queue it
and retry later, or send a bounce to the sender.

Another big issue once you start sending large quantities of messages
- you start getting tarpitted or otherwise blacklisted by mail
servers. Esp. relevent once you start sending 'system generated'
messages that are by nature repetitive - its quite easy for these to
trigger spam measures.


Also any service (elsewhere or appengine itself), that allowed easy
(and esp free) mass mailing would be ripe target for spammers

>
> The specific problem with Google App Engine is that there are
> excecution time / cpu limits (per request), and there are also email
> limits (2000 per day).
>
> On Dec 19, 5:33 am, Greg <g.fawc...@gmail.com> wrote:
>> On Dec 19, 1:00 pm, MajorProgamming <sefira...@gmail.com> wrote:
>>
>> > 1. What would be the best way to implement this considering the
>> > current features available on google app engine (and possibly other
>> > free services)?
>>
>> There are numerous (non-spam) mas mailing services, but no free ones
>> that I know of. Mass mailing is actually quite hard work, which is why
>> you have to pay for this. Unless you own a botnet of course...
> >
>



--
Barry

- www.nearby.org.uk - www.geograph.org.uk -
Reply all
Reply to author
Forward
0 new messages