[Openfirst-cvscommit] base/config/functions mail.php,1.5,1.6
Brought to you by:
xtimg
From: Tim G. <xt...@us...> - 2004-04-15 01:21:52
|
Update of /cvsroot/openfirst/base/config/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21557 Modified Files: mail.php Log Message: Set default mail from, in case it is needed. Index: mail.php =================================================================== RCS file: /cvsroot/openfirst/base/config/functions/mail.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mail.php 13 Sep 2003 19:50:02 -0000 1.5 --- mail.php 15 Apr 2004 01:21:43 -0000 1.6 *************** *** 1,95 **** ! <?php ! /* ! * openFIRST.base - config/functions/mail.php ! * ! * Copyright (C) 2003, ! * openFIRST Project ! * Original Author: Tim Ginn <tim...@po...> ! * ! * 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. ! * 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 ! * ! */ ! // Purpose: Provide mail functions capable of dealing with multi-part messages. ! ! // Produces multi-part mail messages in a manner able to be used as a drop-in replacement for mail(); ! function multipartmail($to, $subject = "openFIRST Mailing", $message = "No message given.", $headers = "", $additionalparamaters = "") { ! global $header; ! global $footer; ! global $basepath; ! ! $fheader = ""; ! $ffooter = ""; ! $info = ""; ! ! $headers .= "Mime-Version: 1.0\r\n"; ! $headers .= "Content-Type: multipart/alternative; boundary=openfirst-mail.boundry\r\n"; ! ! $textmessage = $message; ! ! while(stristr($textmessage,"<")) { ! $textmessage = str_replace(substr($textmessage, strpos($textmessage, "<"), strpos($textmessage, ">") - strpos($textmessage, "<") + 1), "", $textmessage); ! } ! $textmessage = str_replace("<", "<", str_replace(">", ">", $textmessage)); ! ! $info .= "--openfirst-mail.boundry ! Content-Type: text/plain; charset=ISO-8859-1 ! Content-Transfer-Encoding: 7bit ! ! $textmessage ! ! --openfirst-mail.boundry ! Content-Type: text/html; charset=ISO-8859-1 ! Content-Transfer-Encoding: 7bit"; ! ! $fle = fopen($header, "r"); ! while(!feof($fle)) { ! $fheader .= fgets($fle); ! } ! fclose($fle); ! $fle = fopen($footer, "r"); ! while(!feof($fle)) { ! $ffooter .= fgets($fle); ! } ! fclose($fle); ! // Strip the PHP tags from the header. ! while(stristr($fheader,"<?")) { ! $fheader = str_replace(substr($fheader, strpos($fheader, "<?"), strpos($fheader, "?>") - strpos($fheader, "<?") + 2), "", $fheader); ! } ! while(stristr($ffooter,"<?")) { ! $ffooter = str_replace(substr($ffooter, strpos($ffooter, "<?"), strpos($ffooter, "?>") - strpos($ffooter, "<?") + 2), "", $ffooter); ! } ! // Strip the ASP tags from the header. ! ! while(stristr($fheader,"<%")) { ! $fheader = str_replace(substr($fheader, strpos($fheader, "<%"), strpos($fheader, "%>") - strpos($fheader, "<%") + 2), "", $fheader); ! } ! while(stristr($ffooter,"<%")) { ! $ffooter = str_replace(substr($ffooter, strpos($ffooter, "<%"), strpos($ffooter, "%>") - strpos($ffooter, "<%") + 2), "", $ffooter); ! } ! $fheader = str_replace("src=\"/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); ! $fheader = str_replace("src='/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); ! $fheader = str_replace("src=/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); ! $ffooter = str_replace("src=\"/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); ! $ffooter = str_replace("src='/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); ! $ffooter = str_replace("src=/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); ! ! $info .= ("$fheader<pre>$message</pre>$ffooter"); ! return(mail($to, $subject, $info, $headers)); ! } ! ?> --- 1,97 ---- ! <?php ! /* ! * openFIRST.base - config/functions/mail.php ! * ! * Copyright (C) 2003, ! * openFIRST Project ! * Original Author: Tim Ginn <tim...@po...> ! * ! * 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 ! * ! */ ! // Purpose: Provide mail functions capable of dealing with multi-part messages. ! ! // Produces multi-part mail messages in a manner able to be used as a drop-in replacement for mail(); ! function multipartmail($to, $subject = "openFIRST Mailing", $message = "No message given.", $headers = "", $additionalparamaters = "") { ! global $header; ! global $footer; ! global $basepath; ! global $mailfrom; ! ! if(ini_get("sendmail_from") == "") { ! ini_set("sendmail_from", $mailfrom); ! } ! ! $fheader = ""; ! $ffooter = ""; ! $info = ""; ! ! $headers .= "Mime-Version: 1.0\r\n"; ! $headers .= "Content-Type: multipart/alternative; boundary=openfirst-mail.boundry\r\n"; ! ! $textmessage = $message; ! ! while(stristr($textmessage,"<")) { ! $textmessage = str_replace(substr($textmessage, strpos($textmessage, "<"), strpos($textmessage, ">") - strpos($textmessage, "<") + 1), "", $textmessage); ! } ! $textmessage = str_replace("<", "<", str_replace(">", ">", $textmessage)); ! ! $info .= "--openfirst-mail.boundry ! Content-Type: text/plain; charset=ISO-8859-1 ! Content-Transfer-Encoding: 7bit ! ! $textmessage ! ! --openfirst-mail.boundry ! Content-Type: text/html; charset=ISO-8859-1 ! Content-Transfer-Encoding: 7bit"; ! ! $fle = fopen($header, "r"); ! while(!feof($fle)) { ! $fheader .= fgets($fle); ! } ! fclose($fle); ! $fle = fopen($footer, "r"); ! while(!feof($fle)) { ! $ffooter .= fgets($fle); ! } ! fclose($fle); ! // Strip the PHP tags from the header. ! while(stristr($fheader,"<?")) { ! $fheader = str_replace(substr($fheader, strpos($fheader, "<?"), strpos($fheader, "?>") - strpos($fheader, "<?") + 2), "", $fheader); ! } ! while(stristr($ffooter,"<?")) { ! $ffooter = str_replace(substr($ffooter, strpos($ffooter, "<?"), strpos($ffooter, "?>") - strpos($ffooter, "<?") + 2), "", $ffooter); ! } ! // Strip the ASP tags from the header. ! ! while(stristr($fheader,"<%")) { ! $fheader = str_replace(substr($fheader, strpos($fheader, "<%"), strpos($fheader, "%>") - strpos($fheader, "<%") + 2), "", $fheader); ! } ! while(stristr($ffooter,"<%")) { ! $ffooter = str_replace(substr($ffooter, strpos($ffooter, "<%"), strpos($ffooter, "%>") - strpos($ffooter, "<%") + 2), "", $ffooter); ! } ! $fheader = str_replace("src=\"/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); ! $fheader = str_replace("src='/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); ! $fheader = str_replace("src=/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); ! $ffooter = str_replace("src=\"/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); ! $ffooter = str_replace("src='/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); ! $ffooter = str_replace("src=/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); ! ! $info .= ("$fheader<pre>$message</pre>$ffooter"); ! ! return(mail($to, $subject, $info, $headers)); ! } ! ?> |