473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Writing my own mass-email script in PHP

Hi, all. Sorry, first off, for the kidna weird selection of crossposted
groups, but this question touches on aspects of discussion in each of the
groups.

So I have a group of around 500 email addresses to which I would like to
send a mass email occasionally. The group will never be much larger than
500 email addresses and will occasionally be about half that size.

I have written a simple HTML interface and PHP backend to process the
mail. HTML form wiht "subject" and "message body" fields. PHP then gets
all this, gets a list of addresses from a database, and sends the email
out.

What is a good way to proceed with this?

I would like to Bcc: the names on the list so that the "To:" is "Mail
List<ma******@mydomain.edu>" (which is a dummy email address).

I tried using the PHP mail() function and it *seemed* to work, almost.
That is to say, I had added all the names to a long list of Bcc: headers,
and put the extra Bcc: headers in the extra headers argument to the PHP
mail() function. This seemed to work, in that it seemed like everyone got
the email; however, the mail() function came back with a failure error.

I thought about it a bit and researched a little and found that maybe a
really long Bcc: list is not the best idea, for spam reasons (my
message is more likely to be marked as spam) and for other similar
reasons. So I was considering looping through the 500 email addresses and
doing a separate mail() for each, but putting each email address in the
To: field. This sounds like a lot of overhead, though, and I'm afraid of
this thing timing out or crapping out or Something Bad(TM) happening.

I am currently using Sendmail, Linux (Red Hat 9), Apache 1.3.x, and PHP
4.3.8.

I am not crazy about the idea of installing EZMLM only because I would
need to install Qmail and, although that may be a good idea in the long
run, it looks like a bitch (if the length of this page --
http://www.lifewithqmail.org/lwq.html -- is any indication!) I am not
really very experienced with MTA administration!

So, any suggestions? Any comments? Anything?

Thanks!!

--
Jeffrey D. Silverman | je**********@jhu.edu
Website | http://www.newtnotes.com

Drop "PANTS" to reply by email

Jul 17 '05 #1
6 4140
AJ

"Jeffrey Silverman" <je*****@pantsjhu.edu> wrote in message
news:pa****************************@pantsjhu.edu.. .
Hi, all. Sorry, first off, for the kidna weird selection of crossposted
groups, but this question touches on aspects of discussion in each of the
groups.

So I have a group of around 500 email addresses to which I would like to
send a mass email occasionally. The group will never be much larger than
500 email addresses and will occasionally be about half that size.

I have written a simple HTML interface and PHP backend to process the
mail. HTML form wiht "subject" and "message body" fields. PHP then gets
all this, gets a list of addresses from a database, and sends the email
out.

What is a good way to proceed with this?


I've got something like this that sends all the mails out individually
according to recipients specified in a MySQL table. I've sent to just over
1500 people and it worked fine.

It also has an online thing so that you can edit the actual message that
goes out.

If you want, e-mail me offline and I'll zip up the relevant files and send
them to you. I can't promise that the code will be very elegant but you're
welcome to it.

Andy
Jul 17 '05 #2
Jeffrey Silverman wrote:
I tried using the PHP mail() function and it *seemed* to work, almost.
That is to say, I had added all the names to a long list of Bcc: headers,
and put the extra Bcc: headers in the extra headers argument to the PHP
mail() function. This seemed to work, in that it seemed like everyone got
the email; however, the mail() function came back with a failure error.


You could select a smaller number of adresses to bcc: and then loop all your
emails in groups, this would lessen the send load on your mailserver, and at
the same time allow you to send the same message to all the users in your list.
//Aho
Jul 17 '05 #3
Hello,

On 09/27/2004 01:22 PM, Jeffrey Silverman wrote:
I tried using the PHP mail() function and it *seemed* to work, almost.
That is to say, I had added all the names to a long list of Bcc: headers,
and put the extra Bcc: headers in the extra headers argument to the PHP
mail() function. This seemed to work, in that it seemed like everyone got
the email; however, the mail() function came back with a failure error.

I thought about it a bit and researched a little and found that maybe a
really long Bcc: list is not the best idea, for spam reasons (my
message is more likely to be marked as spam) and for other similar
reasons. So I was considering looping through the 500 email addresses and
doing a separate mail() for each, but putting each email address in the
To: field. This sounds like a lot of overhead, though, and I'm afraid of
this thing timing out or crapping out or Something Bad(TM) happening.

I am currently using Sendmail, Linux (Red Hat 9), Apache 1.3.x, and PHP
4.3.8.


You are right. Putting all recipients in Bcc: is not a good idea because
like you noted, some mailbox providers like Hotmail will tag the
messages as junk when the recipient address does not come in a visible
header (To: or Ccc:). Some ISP may also limit the number of recipients
per message that is queued.

Since you use sendmail and your messages are not that urgent, my
suggestion is to configure it to queue all the messages and deliver them
later when the queue is processed next time. This way sendmail will not
hold your PHP script waiting for each delivery.

If you are not aware how to do that, you may want to try this class for
composing and sending e-mail messages that comes with a subclass
specialized in deliveryng via sendmail that provides an option that lets
you tell to defer the delivery of your messages.

If you are not personalizing the messages (which I strongly advise for
efficiency reasons) you may also want to tell the class to cache your
message bodies so it does not waste time rebuilding the message body for
each recipient. You can still personalize the message headers like the
To: header as you need.

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #4
On Mon, 27 Sep 2004 14:35:23 -0300, Manuel Lemos wrote:
http://www.phpclasses.org/mimemessage


Thanks! This looks promising...

--
Jeffrey D. Silverman | je**********@jhu.edu
Website | http://www.newtnotes.com

Drop "PANTS" to reply by email

Jul 17 '05 #5
Jeffrey Silverman wrote:
So I have a group of around 500 email addresses to which I would like to
send a mass email occasionally. The group will never be much larger than
500 email addresses and will occasionally be about half that size.

This was the subject of a question I ask about a membership list about a
year or two ago.

If you will do a google groups search for 'membership list' without the
quotes as a subject, you should find 6 or 8 messages that answer your
question.
Jul 17 '05 #6
On Mon, 27 Sep 2004 12:22:48 -0400, Jeffrey Silverman wrote:
Hi, all. Sorry, first off, for the kidna weird selection of crossposted
groups, but this question touches on aspects of discussion in each of the
groups.

So I have a group of around 500 email addresses to which I would like to
send a mass email occasionally. The group will never be much larger than
500 email addresses and will occasionally be about half that size.

snip <<<


Hi,
I have worked on something like that, I ended up installing bulk_mailer:
ftp://cs.utk.edu/pub/moore/bulk_mailer/
This is a C program which will do quite smart mass-mailing, I have used it
once or twice for the about 5000 subscribers of my newsletter, it worked
without problems.

Since I do everything in PHP as well, and needed to write a web-based
frontend for this newsletter, I simply used the system function from PHP
to use bulk_mailer. It looked something like that:
system('/bin/cat '.PATH_MESSAGE.' | '.PATH_BULK_MAILER.' '.$from.'
'.PATH_RECIPIENTS.' > '.$path_log.' 2>/dev/null');

Before this, I first wrote the newsletter to a file (PATH_MESSAGE), and
the recipients to a file (PATH_RECIPIENTS).
As you can see in the command above, I pipe the contents of the message
(PATH_MESSAGE) into bulk_mailer (PATH_BULK_MAILER), then set the sender
($from) and recipient list (PATH_RECIPIENTS) arguments for bulkmailer.
Finally, I redirected the output into a log ($path_log) and ditched any
error output.

Of course you will have to write some error checks and elsewhat before
using this, but it could give you a hint.

The good news is, bulk_mailer works with sendmail, the bad news is,
bulk_mailer does not seem to work with qmail :(

DrTebi
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mike Henley | last post by:
considering the recent changes to the mysql licensing terms, which meant the php5 team had to adopt sqlite instead into the php5 and drop mysql stuff from the standard language distro (as i...
5
by: Graham Stevenson | last post by:
Hi, I have a USB mass storage device being developed by colleagues, and need to interface that to a Windows Forms application (C#). The device is neither purely a storage device nor an HID...
1
by: John Rauhe | last post by:
Hello, Does anybody know how to detect if an mass-storage device has been added to the system ? I am making a program that will (should) detect when a CompactFlash memory card has been inserted...
1
by: Chris | last post by:
Has anyone ever accomplished a mass update off all databases, tables and columns for collation? If I try to change the collation/character set for the mysql daemon it breaks all of our queries...
1
by: kartik | last post by:
Hi , I am in need to find a way, to mass copy the data from db2 table running in mainframe to universal database db2 on NT. I know that DB2 connect gives the flexiblity of connecting and...
0
by: Ivan | last post by:
Hi, all, How to get BusRelations of a USB Mass Storage Device in C#? Or, do we have any function to get BusRelations of a USB Mass Storage Device, even not in C#? Any information is...
6
by: jimAH | last post by:
Hi all, I'm trying to add the tag <rss version="2.0"> </rss> to an xml file using asp. Any ideas on how to do this? I'm a XML / RSS newbie! I'm coming unstuck as (a) the tage contains a space...
1
by: teo | last post by:
Hallo, I'm performing a mass insertion from a text file to a db table with AdoNet commands, like this: myCommand.CommandText = "BULK INSERT ..." from a Win form no problem
4
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and...
1
by: lawrence k | last post by:
I'm pulling data out of an FLAC file. There is an embedded image. I'm using the great getId3 library (http://getid3.sourceforge.net ). Among the tags I'm pulling out is a mass of binary data,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.