php-windows | 2001042
Date: 04/17/01
- Next message: Ignatius Teo: "RE: [PHP-WIN] [Apache/1.3.19 (Win32) PHP/4.0.5RC1] gd"
- Previous message: Plutarck: "Re: [PHP-WIN] Class Constructors And PHP on Win2K"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
function email_robustly($recipient, $subject, $message, $headers, $smtp)
{
$er = error_reporting(E_ERROR);
$success = mail($recipient, $subject, $message, $headers);
$current_smtp = reset($smtp);
while (!$success && $current_smtp)
{
ini_set('SMTP',$current_smtp);
$success = mail($recipient, $subject, $message, $headers);
$current_smtp = next($smtp);
}
error_reporting($er); //restore the error reporting to what it was
ini_restore('SMTP'); //restore the original php.ini value of the SMTP
return $success;
}
Hey, do you see anything wrong with this function I use to wrap the mail()
function to provide smtp failover? Particularly, would it be thread-safe in
an ISAPI or Apache Module environment?
It works for me; let me know if it works for you, too!
Copyright (C) 2001 Monty Dickerson
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version. This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details. You should have received a copy of the GNU
General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe <email protected> For additional commands, e-mail: php-windows-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Ignatius Teo: "RE: [PHP-WIN] [Apache/1.3.19 (Win32) PHP/4.0.5RC1] gd"
- Previous message: Plutarck: "Re: [PHP-WIN] Class Constructors And PHP on Win2K"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

