From 803b63e8ceff7392a9eae4992dd6e59c1da247cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 17 Aug 2010 06:47:48 +0000 Subject: [PATCH] Old, lost function sendHtmlMail() removed, this is now handled by sendEmail() and a new html_header.tpl email template --- .gitattributes | 1 + inc/extensions/ext-bonus.php | 2 +- inc/functions.php | 16 +++++++++++----- inc/language/bonus_de.php | 4 ++-- inc/libs/html_mail_functions.php | 13 ++----------- inc/modules/admin/what-send_bonus.php | 2 +- inc/modules/admin/what-send_newsletter.php | 2 ++ templates/de/emails/html_header.tpl | 8 ++++++++ 8 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 templates/de/emails/html_header.tpl diff --git a/.gitattributes b/.gitattributes index cf682f6f73..ebcce7a13b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -815,6 +815,7 @@ templates/de/emails/done-member.tpl -text svneol=unset#text/plain templates/de/emails/guest/.htaccess -text svneol=unset#text/plain templates/de/emails/guest/guest_request_confirm.tpl -text svneol=unset#text/plain templates/de/emails/header.tpl -text svneol=unset#text/plain +templates/de/emails/html_header.tpl svneol=native#text/plain templates/de/emails/lock-user.tpl -text svneol=unset#text/plain templates/de/emails/lock_sponsor.tpl -text svneol=unset#text/plain templates/de/emails/member/.htaccess -text svneol=unset#text/plain diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index a88acfd01c..b1bd99402f 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -75,7 +75,7 @@ PRIMARY KEY (`id`) addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` ADD `bonus_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` ADD INDEX (`bonus_id`)"); - // Run this SQL when html or html_mail extension is installed + // Run this SQL when html_mail extension is installed if (isExtensionActive('html_mail')) addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` ADD `html_msg` ENUM('Y','N') NOT NULL DEFAULT 'N'"); break; diff --git a/inc/functions.php b/inc/functions.php index 79bb619c29..57431c9329 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -131,13 +131,22 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' // Check for PHPMailer or debug-mode if ((!checkPhpMailerUsage()) || (isDebugModeEnabled())) { + // Prefix is '' for text mails + $prefix = ''; + + // Is HTML? + if ($isHTML == 'Y') { + // Set prefix + $prefix = 'html_'; + } // END - if + // Not in PHPMailer-Mode if (empty($mailHeader)) { // Load email header template - $mailHeader = loadEmailTemplate('header'); + $mailHeader = loadEmailTemplate($prefix . 'header'); } else { // Append header - $mailHeader .= loadEmailTemplate('header'); + $mailHeader .= loadEmailTemplate($prefix . 'header'); } } // END - if @@ -156,9 +165,6 @@ Message : ' . htmlentities(utf8_decode($message)) . ' // This is always fine return true; - } elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) { - // Send mail as HTML away - return sendHtmlEmail($toEmail, $subject, $message, $mailHeader); } elseif (!empty($toEmail)) { // Send Mail away return sendRawEmail($toEmail, $subject, $message, $mailHeader); diff --git a/inc/language/bonus_de.php b/inc/language/bonus_de.php index a002f9ed55..e19a907e93 100644 --- a/inc/language/bonus_de.php +++ b/inc/language/bonus_de.php @@ -90,10 +90,10 @@ addMessages(array( 'ADMIN_SEND_BONUS_NORMAL' => "Text-Mail versenden", 'ADMIN_SEND_BONUS_HTML' => "HTML-Mail versenden", 'ADMIN_SEND_BONUS_NORMAL_NOTES' => "Standart Text-Mail an Ihre Mitglieder aussenden.", - 'ADMIN_SEND_BONUS_HTML_NOTES' => "HTML-Mail an Ihre Mitglieder versenden. Dazu muss die Erweiterung html_mail jedoch installiert sein.", + 'ADMIN_SEND_BONUS_HTML_NOTES' => "HTML-Mail an Ihre Mitglieder versenden. Dazu muss die Erweiterung html_mail jedoch installiert sein.", 'ADMIN_BONUS_ORDER_BONUS' => "Bonus für eine Mailbuchung", 'ADMIN_BONUS_REFERAL_BONUS' => "Bonus für das Werben eines weiteren Mitgliedes", - 'ADMIN_BONUS_STATS_BONUS' => "Einmalige Bonus bei Erreichen von 100% Klickrate auf eine Mailbuchung (=
Statistik-Bonus)", + 'ADMIN_BONUS_STATS_BONUS' => "Einmalige Bonus bei Erreichen von 100% Klickrate auf eine Mailbuchung (=Statistik-Bonus)", 'ADMIN_BONUS_TURBO_BONUS_TITLE' => "Bonus-{?POINTS?} für bestätigte Mails", 'ADMIN_BONUS_TURBO_TIMEOUT_TITLE' => "Zeitabstände und Aufbewahrungszeiten", 'ADMIN_BONUS_TURBO_MISC_TITLE' => "Sonstige Einstellungen zur Bonus-Erweiterung", diff --git a/inc/libs/html_mail_functions.php b/inc/libs/html_mail_functions.php index 0ca2f48b04..6234dafc6c 100644 --- a/inc/libs/html_mail_functions.php +++ b/inc/libs/html_mail_functions.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // function addValidHtmlTags() { @@ -151,14 +151,5 @@ function insertUrlsIntoHtml ($text) { return preCompileCode(str_replace("\n", "
\n", $text)); } -// Sends a HTML mail to the user -function sendHtmlEmail($to, $subject, $message, $FROM) { - if (isExtensionActive('html_mail')) { - // Send mail away as HTML - $FROM = "Content-Type: text/html; charset=UTF-8\n" . $FROM; - sendEmail($to, $subject, $message, 'N', $FROM); - } // END - if -} - -// +// [EOF] ?> diff --git a/inc/modules/admin/what-send_bonus.php b/inc/modules/admin/what-send_bonus.php index 11735715b8..b07579096c 100644 --- a/inc/modules/admin/what-send_bonus.php +++ b/inc/modules/admin/what-send_bonus.php @@ -82,7 +82,7 @@ if (isFormSent()) { case 'select': // Selection $template = 'admin_send_bonus_select'; break; - } // END - if + } // END - switch // Load template loadTemplate($template, false, $content); diff --git a/inc/modules/admin/what-send_newsletter.php b/inc/modules/admin/what-send_newsletter.php index 2d9eaef8a6..e7b2ca8133 100644 --- a/inc/modules/admin/what-send_newsletter.php +++ b/inc/modules/admin/what-send_newsletter.php @@ -88,6 +88,8 @@ ORDER BY } else { // Copy data into constants for the template and load it $content['datestamp'] = generateDateTime(time(), 3); + + // Extension html_mail installed? if (isExtensionActive('html_mail')) { // Load template with HTML mode loadTemplate('admin_newsletter', false, $content); diff --git a/templates/de/emails/html_header.tpl b/templates/de/emails/html_header.tpl new file mode 100644 index 0000000000..ce27fe5803 --- /dev/null +++ b/templates/de/emails/html_header.tpl @@ -0,0 +1,8 @@ +MIME-Version: 1.0 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-Mailer: {?TITLE?} {?FULL_VERSION?} +Errors-To: {?WEBMASTER?} +Bounces-To: {?WEBMASTER?} +X-Loop: {?WEBMASTER?} +From: "{?MAIN_TITLE?}" <{?WEBMASTER?}> -- 2.39.5