[SOLVED] E-mailing different messages to many users

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
enzymecoding
Forum Newbie
Posts: 3
Joined: Mon Mar 29, 2004 11:49 am

[SOLVED] E-mailing different messages to many users

Post by enzymecoding »

Hello,

I am looking for a script to send different messages to
>1000 email addresses. I found some suggestions in
this forum very interesting.

1- Some say the mail() function is no good for sending
mass emails, probably because a socket is opened for
every single email. Correct?

2- But because I need to send different messages to different
addresses, and I can't use the ability of SMTP to send the same
message to many different users. Should I still use SMTP?

3- What does the mail() function use for sending mail? Where
can I find the source code for it?

4- How good are other mail scripts (like PEAR-Mail) for my task?


Thank you for helping a novice! 8)
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

Mail uses the SMTP server. The real problems are the sockets and the load on the mail server. It might be a good idea to limit the number of emails sent at any one time to 500 or 1000, then have the machine sleep for a while to get the mailserver caught up before beating on it again...
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Look up chron jobs.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Steveo31 wrote:Look up chron jobs.
i thin you mean cron, and how would they help in this case anyway??
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Yea... thats it.

I thought those were for mass mailings, timed or somethin. If not I apologize.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

on a *nix machine you can use cron jobs like you would use MS Task Scheduler on a Windows machine.
enzymecoding
Forum Newbie
Posts: 3
Joined: Mon Mar 29, 2004 11:49 am

Post by enzymecoding »

Lostboy: Thanks for your reply! Are you saying that the
mail() is just as good as doing it manually, since it also
uses SMTP, as long as I let it rest?

I wonder if anyone would use the manual method:
- opening a socket to SMTP
- packaging the mail in an env
- sending it using 'RCPT TO:'

if they are sending different messages to large numbers of users...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Illusionist wrote:
Steveo31 wrote:Look up chron jobs.
i thin you mean cron, and how would they help in this case anyway??
Instead of mailing everyone at one single momment in time. You could schedule 100 emails to be sent every 5 mins until the list is complete.

This would reduce the server load, and also make it very possible to use the standard [php_man]mail[/php_man]() function.

(And yeah, the topic should be mail() vs. sockets; since the backbone of any e-mailing application is infact an SMTP server. ;))
enzymecoding
Forum Newbie
Posts: 3
Joined: Mon Mar 29, 2004 11:49 am

Post by enzymecoding »

I will try that.

Thank you all for your help. I really appreciate this.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

No worries. :)
Post Reply