Re: RE: [PHP-DB] sending bulk emails

2001-11-02 Thread Shane Wright

Hi

If he's going to do it, it should at least be done safely...


- have a status field in your database table (unsent/sent/error)

- update the status field after _every_ email you send.

- do NOT do this in a transaction (otherwise if something dies everything is 
forgotten)

- if the update status query fails, do everything possible to avoid carrying 
on (important if the sending job is in crontab) - this can even be things 
like renaming the database table, deleting itself, anything to make sure it 
doesnt screw up and send any emails that it shouldnt

- dont send too fast.  1000-2000 per hour is good.

- be VERY VERY VERY careful that all the recipients have GIVEN PERMISSION for 
you to email them.  Its not worth the hassle of annoying people or risking 
getting your mail hub blacklisted.


General philosophy: sending too few mails or missing out the odd recipient 
doesnt matter, but NEVER send too many or any duplicates to any person.


Just my 2c

Shane


On Friday 02 November 2001 1:40 pm, Rick Emery wrote:
 GRIN
 True...so very true...

 A little knowledge is a dangerous thing.  In the hands of a spammer...a
 deadly thing...
 /GRIN

 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 7:34 AM
 To: Rick Emery
 Cc: PHP DB list
 Subject: Re: RE: [PHP-DB] sending bulk emails


 Hmmm this is true - but as someone once wrote on this list:

 If someone want's to build a car with 4 reverse gears, we can tell them
 it's not a very good idea,
 but we can also show them how to do it.

 Granted though - spam is a little different than cars!
 Cheers.

 Russ

 On Fri, 2 Nov 2001 07:26:15 -0600  Rick Emery [EMAIL PROTECTED] wrote:
  Opswe've just armed a potential spammer...
 
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 02, 2001 6:20 AM
  To: Cami
  Cc: PHP DB list
  Subject: Re: [PHP-DB] sending bulk emails
 
   Does anybody know how to send bulk emails using php?
 
  Don't do it!!
 
  But of you must - I guess you could build an array containing email
  addresses, names, etc - taken
  from form input or a database or whatever and then loop the arrays
  mailing people...
 
  $mail = mail(;
  for($i=0; $i$email_array_name;$i++( {
  $mail .= $values,;
  }
  $mail .= \$subject\,\$body\,\From: $from\);;
 
  Something like that anyway (that's just off the top of my head)
  Regards.
 
  Russ
 
  On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote:
   Hi guys,
   Does anybody know how to send bulk emails using php?
   Thanks,
   Cami
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
   [EMAIL PROTECTED]
 
  #---#
 
Believe nothing - consider everything
 
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
 
e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
 
www.theruss.com
 
  #---#
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 #---#

   Believe nothing - consider everything

   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge

   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam

   www.theruss.com

 #---#

-- 
Shane

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] sending bulk emails

2001-11-02 Thread Shane Wright

Hi

I find that the best way to do it is with a script having a long/unlimited 
timeout, but limiting it to only a few hundred mails per execution in the SQL 
'... LIMIT 500'.

IMO better this way than a short-timeout script - sending one email can 
sometimes take ages (long DNS lookup, slow connection to the host, etc...)

Shane


On Friday 02 November 2001 4:18 pm, Jonathan Hilgeman wrote:
 Interesting that this should come up. The company I work for needs to send
 out an e-mail to 95k of their subscribers. Now, this is the first time in 2
 years, so you can imagine that we'll be getting 94k of bounced e-mail
 addresses. So I'm writing a script that will handle sending out the e-mails
 and handling incoming bounced e-mail addresses. In any case, I would think
 that my PHP script would time out before sending 95k e-mails. I know it has
 timed out at 30 seconds before, but I can't remember if the faulty script
 had an endless loop for 30 seconds or if there was any data getting sent or
 received in that time. Anyone know beforehand whether I will get a timeout
 with sending these e-mails, and if so, how to work around it?

 - Jonathan

 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 4:20 AM
 To: Cami
 Cc: PHP DB list
 Subject: Re: [PHP-DB] sending bulk emails

  Does anybody know how to send bulk emails using php?

 Don't do it!!

 But of you must - I guess you could build an array containing email
 addresses, names, etc - taken
 from form input or a database or whatever and then loop the arrays mailing
 people...

 $mail = mail(;
 for($i=0; $i$email_array_name;$i++( {
   $mail .= $values,;
   }
 $mail .= \$subject\,\$body\,\From: $from\);;

 Something like that anyway (that's just off the top of my head)
 Regards.

 Russ

 On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote:
  Hi guys,
  Does anybody know how to send bulk emails using php?
  Thanks,
  Cami
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 #---#

   Believe nothing - consider everything

   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge

   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam

   www.theruss.com

 #---#

-- 
Shane

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Please help count ?

2002-04-04 Thread Shane Wright

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


you can do this...

$myvar = ecplode(' ', $postcode);
$firsthalf = $myvar[0];

But not everyone puts the space in there

S

On Thursday 04 April 2002 5:29 pm, Dave Carrera wrote:
 Hi All



 I have a variable returned by my application.



 For clarity it is a post code so result could be



 EX3 T56 or BG56 G67 or CA2 123



 But I only need the first bit of the postcode to continue my search.



 How do I set my var to only include the first bit of the postcode.



 It is returned in the format shown, so my question might be how I read
 only the first bit before the space.



 I fully appreciate any kind of help with this and as always thank you in
 advance for any help.







 Dave Carrera

 Php Developer

 http://davecarrera.freelancers.net

 http://www.davecarrera.com

- -- 
Shane
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8rH/75DXg6dCMBrQRAlEUAJ9R/jfY0Ufdj5yCSiTRw7qB81B3TwCeJELP
GW03u2HKvFXy9fDEEdV1lfg=
=xALC
-END PGP SIGNATURE-


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




[PHP-DB] mySQL max connections

2002-07-30 Thread Shane Wright

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi 

I have a database thats taking a bit of a hammering - enough so that the 
number of connections spirals up and out of control.

max_connections was originally at the default of 100 - but rising above 50 or 
so meant actual throughput dropped so the db never got a chance to keep up 
(meaning manually restarting the db).  I've lowered max_connections to 40 
which at least keeps the db alive.

But, the number of connections keeps rising to and bouncing off this limit - 
and for the users that hit it a 'Too many connections' error is given.

Now, I've optimised everything as much as is humanely possible - and the only 
way out I can see so far is to have some kind of connection queue to keep 
people waiting for the 1/2 second or so until the load spike drops off (I'd 
rather have a few slow pages than errors any day).

Is there any way of doing this - I've looked at back_log (the listen() 
backlog), but that doesnt really apply.

Short of writing a 'hide-warning-wait-a-bit-and-try-again' chunk in PHP 
(sucky!) I'm stuck!

Using persistent connections doesn't stunningly help either - it only gives a 
small performance increase 

Any help appreciated, thanks.

- -- 
Shane
http://www.shanewright.co.uk/
Public key: http://www.shanewright.co.uk/files/public_key.asc
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9RneQ5DXg6dCMBrQRAsQTAKCxNem6+NTNY/I1Wtwstil7axtykACgpUiG
c1e7on4Fu9jgYWhYNLxJAH4=
=H/Op
-END PGP SIGNATURE-


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