function email_robustly($recipient, $subject, $message, $headers, $smtp)

From: Date: Tue, 17 Apr 2001 23:21:23 +0000
Subject: function email_robustly($recipient, $subject, $message, $headers, $smtp)
Groups: php.windows 
Request: Send a blank email to php-windows+get-6805@lists.php.net to get a copy of this message
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.

« previous php.windows (#6805) next »