[Catalyst] Sending 3000 emails.
catalystgroup at unitedgames.co.uk
Wed Dec 2 15:10:23 GMT 2015
Hi Len and Darren,
Atm I'm using Email::Stuffer to send email from within a perl script, in the
Controller folder of my Catalyst app.
I'm assuming this results in it being queued to be sent by the local SMTP
My VPS server has Cpanel, and uses Exim, which I'm guessing is what the
scripts are using to send the email.
As noted, it all works until about 1020 emails in, at which point the
Catalyst app crashes (although this has only happened once - I do not wish
to try again and risk another crash). I am using Email::Stuffer in a for
loop, iterating over an array of 3000 email addresses. For my next step I
will alter my code to only attempt to send to 500 email addresses at any one
time, since below 1000 everything seems to work fine.
You seem to be mentioning using a background process, Darren. Is Exim
already the background process that sends email?
If the long term solution is to use mailgun or sendgrid - before I delve
into all their documentation - do you lot have any tips I should consider,
on how to integrate them with a Catalyst app, or is it all pretty straight
forward once I read the documentation?
----- Original Message -----
From: "Darren Duncan" <darren at darrenduncan.net>
To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>
Sent: Monday, November 30, 2015 11:41 PM
Subject: Re: [Catalyst] Sending 3000 emails.
On 2015-11-30 9:29 AM, Andrew wrote:
> ...given that my attempt to send 3000 emails with nothing but my own VPS
> and Cpan's Email::Stuffer, only sent around 1000, before the
> plack/fastcgi/catalyst app crashed.... could I have been running into a
> limitation? I'm now thinking of altering my code to split the attempts to
> email into six batches of 500 emails, as a short term fix, until I've had
> to research which transactional email partner to use, and how their APIs
> or integrate with Catalyst apps.
If you are trying to send the emails directly from the process serving your
API, then this is absolutely the wrong approach, and you should give up
immediately on trying to do that. Your API process should just queue the
messages to be sent by a separate background process, and then return
immediately such as with a message "3000 messages queued to be sent soon,
here to check queue progress" or such. Sending in-process may be reasonable
a single email, eg email a copy of the form the user just submitted, but
it. -- Darren Duncan
List: Catalyst at lists.scsys.co.uk
Searchable archive: http://firstname.lastname@example.org/
Dev site: http://dev.catalyst.perl.org/
More information about the Catalyst