X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Femail-functions.php;h=1dcfa418bbbe9ad308f1dac248a95456df636d19;hp=1bd2e4e7d74a3cce2e565a3874d4648738c174a9;hb=4373e155854012d687fdfcae4c69d1a940883fab;hpb=96a270e713e9bc75a6199ff76d5f4831b732ff15 diff --git a/inc/email-functions.php b/inc/email-functions.php index 1bd2e4e7d7..1dcfa418bb 100644 --- a/inc/email-functions.php +++ b/inc/email-functions.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Mailversand bezogene Funktionen * * -------------------------------------------------------------------- * - * $Revision:: 2773 $ * - * $Date:: 2012-06-26 01:02:44 +0200 (Tue, 26 Jun 2012) $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: quix0r $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -50,7 +45,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' } // END - if // Set from header - if ((!isInString('@', $toEmail)) && ($toEmail > 0)) { + if ((!isInString('@', $toEmail)) && (isValidId($toEmail))) { // Does the user exist? if ((isExtensionActive('user')) && (fetchUserData($toEmail))) { // Get the email @@ -81,14 +76,18 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' } // END - if // Debug mode enabled? - if (isDebugModeEnabled()) { - // In debug mode we want to display the mail instead of sending it away so we can debug this part - outputHtml('
-Headers : ' . htmlentities(trim($mailHeader)) . '
-To      : ' . htmlentities($toEmail) . '
-Subject : ' . htmlentities($subject) . '
-Message(' . strlen($message) . ') : ' . htmlentities($message) . '
-
'); + if ((isDebugModeEnabled()) && (!isAjaxOutputMode())) { + // Init content array + $content = array( + 'headers' => htmlentities(trim($mailHeader)), + 'to' => htmlentities($toEmail), + 'subject' => htmlentities($subject), + 'message' => htmlentities($message), + 'length' => strlen($message) + ); + + // In debug mode display the mail instead of sending it away so it can be debugged + loadTemplate('display_email', FALSE, $content); // This is always fine return TRUE; @@ -139,7 +138,7 @@ function sendRawEmail ($toEmail, $subject, $message, $headers) { $mail->CharSet = 'UTF-8'; // Path for PHPMailer - $mail->PluginDir = sprintf("%sinc/phpmailer/", getPath()); + $mail->PluginDir = sprintf('%sinc/phpmailer/', getPath()); $mail->IsSMTP(); $mail->SMTPAuth = TRUE; @@ -201,28 +200,6 @@ function sendAdminNotification ($subject, $templateName, $content = array(), $us } } -// ---------------------------------------------------------------------------- -// Template helper functions -// ---------------------------------------------------------------------------- - -// Helper function to add extra headers to text mails -function doTemplateAddExtraTextMailHeaders ($templateName, $clear, $extraHeaders = '') { - // Run the header through the filter - $extraHeaders = runFilterChain('add_extra_text_mail_headers', $extraHeaders); - - // And return it - return $extraHeaders; -} - -// Helper function to add extra headers to HTML mails -function doTemplateAddExtraHtmlMailHeaders ($templateName, $clear, $extraHeaders = '') { - // Run the header through the filter - $extraHeaders = runFilterChain('add_extra_html_mail_headers', $extraHeaders); - - // And return it - return $extraHeaders; -} - // Send mails for del/edit/lock build modes // @TODO $rawUserId is currently unused function sendGenericBuildMails ($mode, $tableName, $content, $id, $subjectPart = '', $userIdColumn = array('userid'), $rawUserId = array('userid')) { @@ -245,7 +222,7 @@ function sendGenericBuildMails ($mode, $tableName, $content, $id, $subjectPart = } // END - if // Is the raw userid set? - if (isValidUserId(postRequestElement($userIdColumn[0], $id))) { + if (isValidId(postRequestElement($userIdColumn[0], $id))) { // Set it in content $content[$userIdColumn[0]] = bigintval(postRequestElement($userIdColumn[0], $id)); @@ -271,5 +248,27 @@ function sendGenericBuildMails ($mode, $tableName, $content, $id, $subjectPart = } } +// ---------------------------------------------------------------------------- +// Template helper functions +// ---------------------------------------------------------------------------- + +// Helper function to add extra headers to text mails +function doTemplateAddExtraTextMailHeaders ($templateName, $clear, $extraHeaders = '') { + // Run the header through the filter + $extraHeaders = runFilterChain('add_extra_text_mail_headers', $extraHeaders); + + // And return it + return $extraHeaders; +} + +// Helper function to add extra headers to HTML mails +function doTemplateAddExtraHtmlMailHeaders ($templateName, $clear, $extraHeaders = '') { + // Run the header through the filter + $extraHeaders = runFilterChain('add_extra_html_mail_headers', $extraHeaders); + + // And return it + return $extraHeaders; +} + // [EOF] ?>