Limits of PHP, SMTP Mailing

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm curious about the limits of my current method of sending out e-
mail w/ php and possibly alternatives.

Right now, I have a mysql DB of registered users. I have a PHP file
accessed daily that runs through the DB and sends e-mails (SMTP
mailer) w/ personalized messages (also from the DB) to the users.
Right now I've only got a few e-mails it needs to send per day so it
only takes a second or two for the file to load/run, but this may
change to a few hundred pretty soon (new system, diff. content). The
content is almost all text, ~1 page long for each person. Does anyone
have any idea how many e-mails I could send out w/ this method
reliably? If the list becomes 100, instead of just a few, think it
will still work? 1000? more?

I find a lot of mass mailer services online, but I can't seem to find
ones that can run through a php code to determine content by user
(personalized). Are there alternatives to my current system that
anyone knows of?

Any thoughts will be appreciated. Thanks!!

Re: Limits of PHP, SMTP Mailing

Quoted text here. Click to load it

It depends on what hardware your SMTP server is running on and on what
else is running on that hardware.  Also, some ISPs impose daily limits
on the number of outgoing messages to avoid overloading their SMTP
servers.  Yahoo!, for example, has a daily limit of 250 outgoing

Quoted text here. Click to load it

A third-party commercial-grade SMTP server to which your script could
connect using phpMailer or a similar library.


Re: Limits of PHP, SMTP Mailing

Quoted text here. Click to load it

It depends how you write your code, how quickly the SMTP server can
enqueue and dequeue requests, and how you invoke the script.

The PHP part is pretty much irrelevant - but you do need to think
about how you manage memory in your own code.


Re: Limits of PHP, SMTP Mailing

Thanks for the feedback. Sorry, I'm not so knowledgeable on this
subject; I have a relatively small, simple script that does work, but
I'm just not sure of it's long-term capability.

I guess what I'm trying to ask is this: what is the best way to send
personalized e-mails to a large list of users and is there a way for
the text in that e-mail to be gathered by running through a php script?

Re: Limits of PHP, SMTP Mailing

Josh wrote:
Quoted text here. Click to load it

Probably the best way is to use one of the bulk mailing scripts - there
are a bunch of them.  Most won't get you the personalization you want,
but some might have some limited use (i.e. "Dear Josh"...).

Alternatively, I think I'd use a database and a batch job.  Put the list
of users in the database, along with the message.  If you only want
minor personalization (i.e. name), you could put one message in there
with placeholders (i.e. <%NAME%>, <$CITY%>, etc.).  Otherwise, you'll
need to put individual messages in there.

One you've loaded the database, a cron job kicks of the batch job to
handle the messages.  When handling, substitute any placeholders with
the proper value and send the message.  Then mark that entry in the
database as sent (in case you want to go back later and look at them).

Depending on how much time it takes, you could handle say 10 messages,
then kick off the same job again and terminate.  When you run out of
messages, just terminate the batch job.

A bunch more programming, but it will handle any sized list.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Limits of PHP, SMTP Mailing


on 05/20/2008 05:45 PM Josh said the following:
Quoted text here. Click to load it

If you can, avoid using SMTP to relay messages to a mail server. It is a
slow method to queue messages for delivery. If you are under Linux/Unix
like systems, it is better to use mail() function as it calls the
sendmail or equivalent program which injects the message on the mail
server queue directly. Even under Windows there are ways to avoid SMTP
protocol overhead.

Other than that, as for personalizing bulk-mail, there are many things
you can do to optimize deliveries by caching message parts that do not
change for each message. You may want to take a look at this MIME
message composing and sending class. It provides several tuning controls
to optimize message composing overhead.

Take a look at the test_smarty_personalized_mailing.php which shows how
to compose and send messages using Smarty to define message text or HTML
from templates.


Manuel Lemos

PHP professionals looking for PHP jobs /

PHP Classes - Free ready to use OOP components written in PHP /

Site Timeline