PDA

View Full Version : Idea for a perl-mysql mailer que



hondaworkshop
01-15-2007, 12:33 PM
My project does not send mass emailings to a list, but it does allow community users to send emails to each other.

Obviously, if the project reaches its potential, the raised limit of 500-emails-per hour might not be enough, and there would be a need for a queue of sorts to let emails roll over into the next hour, instead of being killed.

My idea is to put the user's email form data into a MySQL database, then create a perl script that would run every 2 minutes, sending out 14 emails from the database and marking them as "sent" so it would ignore them later.

This would total up to 420 emails per hour, allowing 80 more to spare for other conventional email use.

The emails sent out are all text-based emails, with very small message content. My questions are:

Would this perl script be able send out the 14 tiny emails fast enough that the server would not kill it for taking too long?

Is every 2 minutes too frequent to run the script? Should I decrease the number of emails and make it every 1 minute?

Is there already something like this out there?

siguie
01-16-2007, 04:51 AM
Yes, though it seems like waste of a MySQL database. You could just make it a flat file and have a cron job run it.

Anyways, the queue idea is pretty straightforward but to my knowledge there is still no way to know how many emails have been sent each hour. So you are just hoping that all of the messages make it out.

Oh and if you really want to go the MySQL route php is generally better and the List Server software here has a way of queing emails which depending on what you want might be easier.

hondaworkshop
01-16-2007, 09:14 AM
Thanks for the input, siguie.

I didnt realize I could cron a php file instead of a perl. It would be much easier for me to build in php, but I was thinking the perl script would run faster than php (right?), and MySQL query of 14 lines would be faster than opening a flat file with thousands of lines. My concern is getting the 14 emails out within the 30-second limit, every two minutes.

I would love to use the built in list server, but I'm not sending one email to a huge list of people. These are hundreds of one-off emails between users. Can the list server do that?

Alternately, I'm considering putting the messages into a db file instead of deploying them, and making users sign on to look at thier messages.

For now 500 emails is enough for my small user base, I just dont like the idea that when things get big enough that emails get killed, it will be a disaster.

siguie
01-17-2007, 02:13 AM
I haven't measured the relative speeds but it was my understanding that php is almost always faster.

Sending out 14 emails in 30 seconds better not be a problem ... I have ancient systems that can do better than that.

I haven't tried using the list server in this way but there is supposedly a way to personalize each message sent out. In "theory" all that would be needed is to make the "bulk messsage" blank and insert the appropriate mail message as the "personal" part. Atleast that's what I was thinking ... that and the que system is already writen and you might be able to just rip it out and run it solo.

hondaworkshop
01-17-2007, 09:18 AM
I haven't tried using the list server in this way but there is supposedly a way to personalize each message sent out. In "theory" all that would be needed is to make the "bulk messsage" blank and insert the appropriate mail message as the "personal" part. Atleast that's what I was thinking ... that and the que system is already writen and you might be able to just rip it out and run it solo.

This is a great idea! I have done mass emails with personalized feilds before, but I never thought of just making the whole email body one big personalized field.

I'll look into doing it this way first. Thanks again for your input! :)