| ... | ... |
@@ -50,7 +50,7 @@ function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$ |
| 50 | 50 |
$subject = descript(strip_tags($subject)); |
| 51 | 51 |
$message = descript($message); |
| 52 | 52 |
// End paranoia |
| 53 |
- |
|
| 53 |
+ |
|
| 54 | 54 |
// Try to determine the right $type setting |
| 55 | 55 |
if(strpos($message, "<br>") || strpos($message, "</p>") || strpos($message, "<br />") || strpos($message, "<br>") || strpos($message, "<a href")) $type = "html"; |
| 56 | 56 |
|
| ... | ... |
@@ -100,7 +100,7 @@ function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$ |
| 100 | 100 |
$mail->ErrorInfo; |
| 101 | 101 |
$mail->ClearAllRecipients(); |
| 102 | 102 |
$mail->ClearReplyTos(); |
| 103 |
- return false; |
|
| 103 |
+ return $mail->ErrorInfo; |
|
| 104 | 104 |
} else {
|
| 105 | 105 |
$mail->ClearAllRecipients(); |
| 106 | 106 |
$mail->ClearReplyTos(); |
| ... | ... |
@@ -28,8 +28,9 @@ if(!defined("_CHARSET")) exit( );
|
| 28 | 28 |
|
| 29 | 29 |
|
| 30 | 30 |
function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$type="plain",$cc="",$bcc="") {
|
| 31 |
- |
|
| 32 |
- global $language, $smtp_host, $smtp_username, $smtp_password; |
|
| 31 |
+ |
|
| 32 |
+ global $language, $smtp_host, $smtp_username, $smtp_password, $siteemail; |
|
| 33 |
+ |
|
| 33 | 34 |
// Check for hackers and spammers and bad input |
| 34 | 35 |
if(!isset($_SERVER['HTTP_USER_AGENT'])) return false; |
| 35 | 36 |
$badStrings = array("Content-Type:", "MIME-Version:", "Content-Transfer-Encoding:", "bcc:", "cc:");
|
| ... | ... |
@@ -71,7 +72,7 @@ function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$ |
| 71 | 72 |
$mail->Password = $smtp_password; |
| 72 | 73 |
} |
| 73 | 74 |
$mail->CharSet = _CHARSET; |
| 74 |
- $mail->From = $from_email; |
|
| 75 |
+ $mail->From = $siteemail; |
|
| 75 | 76 |
$mail->FromName = $from_name; |
| 76 | 77 |
$mail->AddAddress($to_email, $to_name); |
| 77 | 78 |
$mail->AddReplyTo($from_email, $from_name); |
| ... | ... |
@@ -53,12 +53,12 @@ function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$ |
| 53 | 53 |
// Try to determine the right $type setting |
| 54 | 54 |
if(strpos($message, "<br>") || strpos($message, "</p>") || strpos($message, "<br />") || strpos($message, "<br>") || strpos($message, "<a href")) $type = "html"; |
| 55 | 55 |
|
| 56 |
- require_once(_BASEDIR."includes/phpmailer_include.php"); |
|
| 57 |
- $mail = new PHPMailer( ); |
|
| 58 |
- if(file_exists("languages/mailer/phpmailer.lang-".$language.".php"))
|
|
| 59 |
- $mail->SetLanguage($language, "language/mailer/"); |
|
| 56 |
+ require_once(_BASEDIR."includes/PHPMailerAutoload.php"); |
|
| 57 |
+ $mail = new PHPMailer; |
|
| 58 |
+ if(file_exists(_BASEDIR."languages/mailer/phpmailer.lang-".$language.".php")) |
|
| 59 |
+ $mail->SetLanguage($language, _BASEDIR."languages/mailer/"); |
|
| 60 | 60 |
else |
| 61 |
- $mail->SetLanguage("en", "language/mailer/");
|
|
| 61 |
+ $mail->SetLanguage("en", _BASEDIR."languages/mailer/");
|
|
| 62 | 62 |
|
| 63 | 63 |
if(!$smtp_host) {
|
| 64 | 64 |
$mail->IsMail( ); |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,110 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+// ---------------------------------------------------------------------- |
|
| 4 |
+// eFiction 3.2 |
|
| 5 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 6 |
+// Valid HTML 4.01 Transitional |
|
| 7 |
+// Based on eFiction 1.1 |
|
| 8 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 9 |
+// http://efiction.sourceforge.net/ |
|
| 10 |
+// ---------------------------------------------------------------------- |
|
| 11 |
+// LICENSE |
|
| 12 |
+// |
|
| 13 |
+// This program is free software; you can redistribute it and/or |
|
| 14 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 15 |
+// as published by the Free Software Foundation; either version 2 |
|
| 16 |
+// of the License, or (at your option) any later version. |
|
| 17 |
+// |
|
| 18 |
+// This program is distributed in the hope that it will be useful, |
|
| 19 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 20 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 21 |
+// GNU General Public License for more details. |
|
| 22 |
+// |
|
| 23 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 24 |
+// ---------------------------------------------------------------------- |
|
| 25 |
+ |
|
| 26 |
+if(!defined("_CHARSET")) exit( );
|
|
| 27 |
+ |
|
| 28 |
+ |
|
| 29 |
+ |
|
| 30 |
+function sendemail($to_name,$to_email,$from_name,$from_email,$subject,$message,$type="plain",$cc="",$bcc="") {
|
|
| 31 |
+ |
|
| 32 |
+ global $language, $smtp_host, $smtp_username, $smtp_password; |
|
| 33 |
+ // Check for hackers and spammers and bad input |
|
| 34 |
+ if(!isset($_SERVER['HTTP_USER_AGENT'])) return false; |
|
| 35 |
+ $badStrings = array("Content-Type:", "MIME-Version:", "Content-Transfer-Encoding:", "bcc:", "cc:");
|
|
| 36 |
+ $checks = array($to_name, $to_email, $from_name, $from_email, $subject); |
|
| 37 |
+ foreach($checks as $check) {
|
|
| 38 |
+ foreach($badStrings as $bad){
|
|
| 39 |
+ if(strpos($check, $bad) !== false) return false; // Spammer |
|
| 40 |
+ } |
|
| 41 |
+ } |
|
| 42 |
+ unset($bad, $badStrings, $checks, $check); |
|
| 43 |
+ if (!((bool) preg_match('/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD', $to_email))) return false; // Bad e-mail
|
|
| 44 |
+ if (!((bool) preg_match('/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD', $from_email))) {
|
|
| 45 |
+ echo "bad email"; |
|
| 46 |
+ return false; // Bad e-mail |
|
| 47 |
+ } |
|
| 48 |
+ if (empty($_SERVER['HTTP_USER_AGENT']) || !$_SERVER['REQUEST_METHOD'] == "POST") return false; // Spammer |
|
| 49 |
+ $subject = descript(strip_tags($subject)); |
|
| 50 |
+ $message = descript($message); |
|
| 51 |
+ // End paranoia |
|
| 52 |
+ |
|
| 53 |
+ // Try to determine the right $type setting |
|
| 54 |
+ if(strpos($message, "<br>") || strpos($message, "</p>") || strpos($message, "<br />") || strpos($message, "<br>") || strpos($message, "<a href")) $type = "html"; |
|
| 55 |
+ |
|
| 56 |
+ require_once(_BASEDIR."includes/phpmailer_include.php"); |
|
| 57 |
+ $mail = new PHPMailer( ); |
|
| 58 |
+ if(file_exists("languages/mailer/phpmailer.lang-".$language.".php"))
|
|
| 59 |
+ $mail->SetLanguage($language, "language/mailer/"); |
|
| 60 |
+ else |
|
| 61 |
+ $mail->SetLanguage("en", "language/mailer/");
|
|
| 62 |
+ |
|
| 63 |
+ if(!$smtp_host) {
|
|
| 64 |
+ $mail->IsMail( ); |
|
| 65 |
+ } |
|
| 66 |
+ else {
|
|
| 67 |
+ $mail->IsSMTP( ); |
|
| 68 |
+ $mail->Host = $smtp_host; |
|
| 69 |
+ $mail->SMTPAuth = true; |
|
| 70 |
+ $mail->Username = $smtp_username; |
|
| 71 |
+ $mail->Password = $smtp_password; |
|
| 72 |
+ } |
|
| 73 |
+ $mail->CharSet = _CHARSET; |
|
| 74 |
+ $mail->From = $from_email; |
|
| 75 |
+ $mail->FromName = $from_name; |
|
| 76 |
+ $mail->AddAddress($to_email, $to_name); |
|
| 77 |
+ $mail->AddReplyTo($from_email, $from_name); |
|
| 78 |
+ if($cc) {
|
|
| 79 |
+ $cc = explode(", ", $cc);
|
|
| 80 |
+ foreach ($cc as $ccaddress) {
|
|
| 81 |
+ $mail->AddCC($ccaddress); |
|
| 82 |
+ } |
|
| 83 |
+ } |
|
| 84 |
+ if ($bcc) {
|
|
| 85 |
+ $bcc = explode(", ", $bcc);
|
|
| 86 |
+ foreach ($bcc as $bccaddress) {
|
|
| 87 |
+ $mail->AddBCC($bccaddress); |
|
| 88 |
+ } |
|
| 89 |
+ } |
|
| 90 |
+ if ($type == "plain") {
|
|
| 91 |
+ $mail->IsHTML(false); |
|
| 92 |
+ } else {
|
|
| 93 |
+ $mail->IsHTML(true); |
|
| 94 |
+ } |
|
| 95 |
+ |
|
| 96 |
+ $mail->Subject = $subject; |
|
| 97 |
+ $mail->Body = $message; |
|
| 98 |
+ if(!$mail->Send()) {
|
|
| 99 |
+ $mail->ErrorInfo; |
|
| 100 |
+ $mail->ClearAllRecipients(); |
|
| 101 |
+ $mail->ClearReplyTos(); |
|
| 102 |
+ return false; |
|
| 103 |
+ } else {
|
|
| 104 |
+ $mail->ClearAllRecipients(); |
|
| 105 |
+ $mail->ClearReplyTos(); |
|
| 106 |
+ return true; |
|
| 107 |
+ } |
|
| 108 |
+ |
|
| 109 |
+} |
|
| 110 |
+?> |
|
| 0 | 111 |
\ No newline at end of file |