RE: [PHP-DB] newsletter optimization help needed

2003-03-12 Thread Miles Thompson
I've been doing that with a much smaller list, and we periodically run into 
problems with subscribers SPAM filter, double-propagation of some 
addresses, etc.  I think the days of bcc: are numbered.

The approach we're working on now is to send an URL to subscribers. They 
click on that and view the newsletter through Flash player.

As for Chris's problem, I don't know. I'd be tempted to have the PHP script 
pass a set of parameters to a Python script and then end. When the Python 
script completes have that email the results to the user. A friend of mine 
used a similar process to handle requests for huge amounts of geological 
data. The parameters were passed to the database which generated the file 
and called a script to mail them. The original page was long since gone.

Miles

At 09:56 AM 3/12/2003 -0800, SELPH,JASON (HP-Richardson,ex1) wrote:
You could change the TO: to something generic like "Email List Subscriber"
then add everyone to the BCC field and then generate 1 email with 9000
people in the BCC field.  Let sendmail do the rest.  It should take less
time to send the emails and only a few seconds to generate your page.
Cheers
Jason
-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 11:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] newsletter optimization help needed
Hi there Everyone,

Below is some code I use to send a newsletter to clients subscribed on my
mailing list.  The problem is I have over
9000+ email addresses in the DB and it takes around 30-45 minutes to
send them with the below code.
Can anyone see someway I can optimize it so it sends out the newsletter any
faster?  I've probably gone about this system the long way, but it works - I
just need to find a way to make it faster :-(
Thanks everyone

All the best

Chris

---



$connection = mysql_connect("localhost","Username","Password") or
die("Couldn't make a connection.");
$db = mysql_select_db("WhateverDB", $connection)
or die("Couldn't select database.");
$sql = "SELECT *
FROM emailtest";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
while ($row = mysql_fetch_array($sql_result)) {
$emailadd = $row["EMail"];
$emailname = $row["emailname"];
$emailphone = $row["emailphone"];
$emailaddress = $row["emailaddress"];
$MP = "sendmail -t";
$HT = "";
$HT = "";
$subject = "$subject";
$NOTE = "$emailtests";
$NOTE = str_replace("*email*", "$emailadd", $NOTE);
$NOTE = str_replace("*name*", "$emailname", $NOTE);
$NOTE = str_replace("*phone*", "$emailphone", $NOTE);
$NOTE = str_replace("*address*", "$emailaddress", $NOTE);
$TO = "$emailadd";
$fd = popen($MP,"w");
fputs($fd,"MIME-Version: 1.0\r\n");
fputs($fd,"Content-type: text/html; charset=iso-8859-1\r\n"); fputs($fd,
"To: $TO\n");
fputs($fd, "From: [EMAIL PROTECTED]");
fputs($fd, "Subject: $subject\n");
fputs($fd, "X-Mailer: PHP3\n");
fputs($fd, "Email: $email\n");
fputs($fd, "$HT");
fputs($fd, "$NOTE");
fputs($fd, "$EHT");
}

pclose($fd);
exit;
mysql_free_result($sql_result);
mysql_close($connection);
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] newsletter optimization help needed

2003-03-12 Thread SELPH,JASON (HP-Richardson,ex1)
You could form them into an array and then use implode with whatever
delimiter sendmail uses (unless you changed it I believe it is just a
comma).  To test it, try limiting your select statement to the first 50 or
so, then echo everything into a test output page.  Then try with a defined
limit of 1 or 2 to email it to a few test email accounts (hotmail or
whatever) and see if it all works.  I stress this as I may have accidently
at one time in the past tried a test similar to yours with live data.
Needless to say our exchange admin was a bit unhappy.

Jason

-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 12:14 PM
To: php
Subject: Re: [PHP-DB] newsletter optimization help needed


Hi there.

That makes sense :-)  One question, my brain is kind of dead today (Some
would say always :-)  But how would I get $emailadd to display all the
addresses in the bcc bit?  I know you have to add the addresses, seperate
them with a , etc . but for the life of me I can't think straight right
now :-(

Thanks

Chris
---
while ($row = mysql_fetch_array($sql_result)) {
 $emailadd = $row["EMail"];
 $emailname = $row["emailname"];
 $emailphone = $row["emailphone"];
 $emailaddress = $row["emailaddress"];

};

> You could change the TO: to something generic like "Email List 
> Subscriber" then add everyone to the BCC field and then generate 1 
> email with 9000 people in the BCC field.  Let sendmail do the rest.  
> It should take less time to send the emails and only a few seconds to 
> generate your page.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] newsletter optimization help needed

2003-03-12 Thread Jason Wong
On Thursday 13 March 2003 02:14, Chris Payne wrote:

> That makes sense :-)  One question, my brain is kind of dead today (Some
> would say always :-)  But how would I get $emailadd to display all the
> addresses in the bcc bit?  I know you have to add the addresses, seperate
> them with a , etc . but for the life of me I can't think straight right
> now :-(

The easiest method is to stick them all into an array then implode them using 
a comma as the delimiter.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Love isn't only blind, it's also deaf, dumb, and stupid.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] newsletter optimization help needed

2003-03-12 Thread Chris Payne
Hi there.

That makes sense :-)  One question, my brain is kind of dead today (Some
would say always :-)  But how would I get $emailadd to display all the
addresses in the bcc bit?  I know you have to add the addresses, seperate
them with a , etc . but for the life of me I can't think straight right
now :-(

Thanks

Chris
---
while ($row = mysql_fetch_array($sql_result)) {
 $emailadd = $row["EMail"];
 $emailname = $row["emailname"];
 $emailphone = $row["emailphone"];
 $emailaddress = $row["emailaddress"];

};

> You could change the TO: to something generic like "Email List Subscriber"
> then add everyone to the BCC field and then generate 1 email with 9000
> people in the BCC field.  Let sendmail do the rest.  It should take less
> time to send the emails and only a few seconds to generate your page.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] newsletter optimization help needed

2003-03-12 Thread SELPH,JASON (HP-Richardson,ex1)
You could change the TO: to something generic like "Email List Subscriber"
then add everyone to the BCC field and then generate 1 email with 9000
people in the BCC field.  Let sendmail do the rest.  It should take less
time to send the emails and only a few seconds to generate your page.

Cheers
Jason

-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 11:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] newsletter optimization help needed


Hi there Everyone,
 
Below is some code I use to send a newsletter to clients subscribed on my
mailing list.  The problem is I have over
9000+ email addresses in the DB and it takes around 30-45 minutes to
send them with the below code.
 
Can anyone see someway I can optimize it so it sends out the newsletter any
faster?  I've probably gone about this system the long way, but it works - I
just need to find a way to make it faster :-(
 
Thanks everyone
 
All the best
 
Chris
 
---
 
";
$HT = "";
$subject = "$subject";
$NOTE = "$emailtests";
 
$NOTE = str_replace("*email*", "$emailadd", $NOTE);
$NOTE = str_replace("*name*", "$emailname", $NOTE);
$NOTE = str_replace("*phone*", "$emailphone", $NOTE);
$NOTE = str_replace("*address*", "$emailaddress", $NOTE);
 
$TO = "$emailadd"; 
$fd = popen($MP,"w"); 
fputs($fd,"MIME-Version: 1.0\r\n");
fputs($fd,"Content-type: text/html; charset=iso-8859-1\r\n"); fputs($fd,
"To: $TO\n"); 
fputs($fd, "From: [EMAIL PROTECTED]"); 
fputs($fd, "Subject: $subject\n"); 
fputs($fd, "X-Mailer: PHP3\n");  
fputs($fd, "Email: $email\n");
fputs($fd, "$HT");
fputs($fd, "$NOTE");
fputs($fd, "$EHT");
 
}
 
pclose($fd); 
exit; 
 
mysql_free_result($sql_result);
mysql_close($connection);
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php