Hi!
Mit dieser Modifikation ist es möglich Emails als HTML zu versenden.
Neue Dateien:
lang/yourLang/email/
activation_success_html.html
admin_activation_html.html
admin_email_html.html
lost_password_html.html
mailform_message_html.html
newemail_activation_html.html
postcard_message_html.html
register_activation_admin_html.html
register_activation_html.html
register_activation_none_html.html
upload_notify_html.html
includes/
class.phpmailer.php
class.smtp.php
email_bridge.php
ein neuer Ordner in lang/yourLang/email/images/
Alle aufgelisteten Dateien könnt ihr Downloaden (Anhang), und in die entsprechenden Ordner Kopieren.
1.) erstellt in lang/yourLang/email/ einen neuen Ordner und benennt in "images". (lang/yourLang/email/images/)
Kopiert alle Bilder aus der "html_email_files.zip" in diesen Ordner, die anderen Dateien in die ensprechenden Ordner auf euren FTP.
(Später könnt ihr eure Standard Bilder, für die Emails (Banner) e.t.c dort hinein Kopieren.
Eure Standard Bilder müßt ihr in der "includes/email_bridge.php" Definieren, und gegebenfalls auch in den entsprechenden neuen *_html.html Dateien.)
Stellt in ACP/Allgemein/Einstellungen:
"SMTP Server für den Versand von Emails verwenden" auf "ein".
2.) suche in der admin/email.php:
if ($action == "sendemails") {
$error = array();
$subject = stripslashes(trim($HTTP_POST_VARS['subject']));
$message = stripslashes(trim($HTTP_POST_VARS['message']));
if ($subject == "") {
$error['subject'] = 1;
}
if ($message == "") {
$error['message'] = 1;
}
if (!isset($HTTP_POST_VARS['emails']) || empty($HTTP_POST_VARS['emails'])) {
$error['emails'] = 1;
}
if (empty($error)) {
@set_time_limit(1200);
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($config['site_email']);
$site_email->set_subject($subject);
$site_email->register_vars(array(
"message" => $message,
"site_email" => $config['site_email'],
"site_name" => $config['site_name']
));
$site_email->set_body("admin_email", $config['language_dir']);
$emails = $HTTP_POST_VARS['emails'];
$site_email->set_bcc($emails);
echo ($site_email->send_email()) ? $lang['send_emails_success'] : $lang['send_emails_error'];
echo "<p>";
show_text_link($lang['back'], "javascript:history.back(1)");
}
else {
$msg = sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']);
$action = "emailusers";
}
}
ersetze es mit:
if ($action == "sendemails") {
$error = array();
$subject = stripslashes(trim($HTTP_POST_VARS['subject']));
$message = format_text(trim(stripslashes($HTTP_POST_VARS['message'])), 1);
$alt_message = format_text(trim(stripslashes($HTTP_POST_VARS['message'])));
$emails = $HTTP_POST_VARS['emails'];
if ($subject == "") {
$error['subject'] = 1;
}
if ($message == "") {
$error['message'] = 1;
}
if (!isset($HTTP_POST_VARS['emails']) || empty($HTTP_POST_VARS['emails'])) {
$error['emails'] = 1;
}
if (empty($error)) {
$site_mailtemplate->register_vars(array(
"subject" => $subject,
"message" => $message,
));
$email_template = "admin_email_html";
require(ROOT_PATH.'includes/email_bridge.php');
show_text_link($lang['back'], "javascript:history.back(1)");
}
else {
$msg = sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']);
$action = "emailusers";
}
}
3.) suche in der admin\users.php:
if ($result && $config['account_activation'] == 2 && $activation && $user_level != USER_AWAITING) {
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($user_email);
$site_email->set_subject($lang['activation_success_emailsubject']);
$site_email->register_vars(array(
"user_name" => $user_name,
"site_name" => $config['site_name']
));
$site_email->set_body("activation_success", $config['language_dir']);
$site_email->send_email();
}
ersetze es mit:
if ($result && $config['account_activation'] == 2 && $activation && $user_level != USER_AWAITING) {
$email_to = $user_email;
$email_subject = ($lang['activation_success_emailsubject']);
$site_mailtemplate->register_vars(array(
"script_url" => $script_url."/index.php",
"user_name" => $user_name,
"subject" => $email_subject,
));
$email_template = "activation_success_html";
include(ROOT_PATH.'includes/email_bridge.php');
}
4.) suche in der member.php:
if ($config['upload_notify'] == 1 && !$direct_upload) {
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$config['upload_emails'] = str_replace(" ", "", $config['upload_emails']);
$emails = explode(",", $config['upload_emails']);
$validation_url = $script_url."/admin/index.php?goto=".urlencode("validateimages.php?action=validateimages");
$site_email->set_to($config['site_email']);
$site_email->set_subject($lang['new_upload_emailsubject']);
$site_email->register_vars(array(
"image_name" => stripslashes($image_name),
"file_name" => $new_name,
"cat_name" => $cat_cache[$cat_id]['cat_name'],
"validation_url" => $validation_url,
"site_name" => $config['site_name']
));
$site_email->set_body("upload_notify", $config['language_dir_default']);
$site_email->set_bcc($emails);
$site_email->send_email();
}
ersetze es mit:
if ($config['upload_notify'] == 1 && !$direct_upload) {
$config['upload_emails'] = str_replace(" ", "", $config['upload_emails']);
$email_to = $config['site_email'].",".$config['upload_emails'];
$email_subject = $lang['new_upload_emailsubject'];
$validation_url = $script_url."/admin/index.php?goto=".urlencode("validateimages.php?action=validateimages");
$file_path = THUMB_TEMP_DIR.'/'.$new_name;
$file_name = $new_name;
$site_mailtemplate->register_vars(array(
"lang_media_file" => $lang['media_file'],
"lang_image_name" => $lang['image_name'],
"lang_date" => $lang['date'],
"lang_category" => $lang['category'],
"lang_added_by" => $lang['added_by'],
"lang_description" => $lang['description'],
"lang_keywords" => $lang['keywords'],
"image_description" => $image_description,
"image_keywords" => $image_keywords,
"user_name" => $user_info['user_name'],
"image_name" => stripslashes($image_name),
"file_name" => $new_name,
"cat_name" => $cat_cache[$cat_id]['cat_name'],
"validation_url" => $validation_url,
"subject" => $lang['new_upload_emailsubject'],
"current_time" => format_date($config['date_format']." ".$config['time_format'], $current_time),
));
$email_template = "upload_notify_html";
include(ROOT_PATH.'includes/email_bridge.php');
}
4.1) suche:
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_from($sender_user_email, $sender_user_name);
$site_email->set_to($user_row['user_email']);
$site_email->set_subject($subject);
$site_email->register_vars(array(
"sender_user_name" => $sender_user_name,
"sender_user_email" => $sender_user_email,
"message" => $message,
"site_name" => $config['site_name']
));
$site_email->set_body("mailform_message", $config['language_dir']);
$site_email->send_email();
$msg = $lang['emailuser_success'];
ersetze:
$email_to = $user_row['user_email'];
$add_email_from = $sender_user_email;
$add_email_from_name = $sender_user_name;
$message = format_text(trim(stripslashes($HTTP_POST_VARS['message'])), 1);
$email_subject = "Nachricht von $sender_user_name";
$email_template = "mailform_message_html";
$site_mailtemplate->register_vars(array(
"sender_user_name" => $sender_user_name,
"sender_user_email" => $sender_user_email,
"message" => $message,
"subject" => $subject,
));
include(ROOT_PATH.'includes/email_bridge.php');
$msg = $lang['emailuser_success'];
4.2) suche:
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($user_email);
$site_email->set_subject($lang['send_password_emailsubject']);
$site_email->register_vars(array(
"user_name" => $checkuser[$user_table_fields['user_name']],
"user_password" => stripslashes($user_password),
"site_name" => $config['site_name']
));
$site_email->set_body("lost_password", $config['language_dir']);
$site_email->send_email();
ersetze es mit:
$email_to = ($user_email);
$email_subject = ($lang['send_password_emailsubject']);
$site_mailtemplate->register_vars(array(
"lang_user_name" => $lang['user_name'],
"lang_password" => $lang['password'],
"user_name" => $checkuser[$user_table_fields['user_name']],
"user_password" => stripslashes($user_password),
"site_name" => $config['site_name'],
"subject" => $email_subject
));
$email_template = "lost_password_html";
include(ROOT_PATH.'includes/email_bridge.php');
4.3) suche:
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
switch($config['account_activation']) {
case 2:
$user_details_url = $script_url."/admin/index.php?goto=".urlencode("users.php?action=edituser&user_id=".$user_info['user_id']."&activation=1");
$email_to = $config['site_email'];
$email_subject = $lang['admin_activation_emailsubject'];
$email_template = "admin_activation";
$new_email_msg = $lang['update_email_instruction_admin'];
break;
case 1:
if ($config['language_dir_default'] != $config['language_dir']) {
$activation_url .= "&l=".$config['language_dir'];
}
$user_details_url = "";
$email_to = $user_email;
$email_subject = $lang['update_email_emailsubject'];
$email_template = "newemail_activation";
$new_email_msg = $lang['update_email_instruction'];
break;
case 0:
default:
break;
}
if (!empty($email_to)) {
$site_email->set_to($email_to);
$site_email->set_subject($email_subject);
$site_email->register_vars(array(
"user_details_url" => $user_details_url,
"activation_url" => $activation_url,
"user_name" => $user_info['user_name'],
"site_name" => $config['site_name']
));
$site_email->set_body($email_template, $config['language_dir']);
$site_email->send_email();
}
ersetze es mit:
switch($config['account_activation']) {
case 2:
$user_details_url = $script_url."/admin/index.php?goto=".urlencode("users.php?action=edituser&user_id=".$user_info['user_id']."&activation=1");
$email_to = $config['site_email'];
$email_subject = $lang['admin_activation_emailsubject'];
$email_template = "admin_activation_html";
$new_email_msg = $lang['update_email_instruction_admin'];
break;
case 1:
if ($config['language_dir_default'] != $config['language_dir']) {
$activation_url .= "&l=".$config['language_dir'];
}
$user_details_url = "";
$email_to = $user_email;
$email_subject = $lang['update_email_emailsubject'];
$email_template = "newemail_activation_html";
$new_email_msg = $lang['update_email_instruction'];
break;
case 0:
default:
break;
}
if (!empty($email_to)) {
$email_to = $email_to;
$email_subject = $email_subject;
$site_mailtemplate->register_vars(array(
"lang_profile" => $lang['profile'],
"lang_admin_activation_emailsubject" => $lang['admin_activation_emailsubject'],
"lang_user_name" => $lang['user_name'],
"lang_date" => $lang['date'],
"lang_email" => $lang['email'],
"user_email" => $user_email,
"current_date" => format_date($config['date_format']." ".$config['time_format'], time()),
"user_details_url" => $user_details_url,
"activation_url" => $activation_url,
"user_name" => $user_info['user_name'],
"subject" =>$email_subject
));
$email_template = $email_template;
include(ROOT_PATH.'includes/email_bridge.php');
}
5.) suche in der register.php:
if ($result) {
$activation_url = $script_url."/register.php?action=activate&activationkey=".$activationkey;
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($user_email);
$site_email->set_subject($lang['register_success_emailsubject']);
$site_email->register_vars(array(
"activation_url" => $activation_url,
"user_name" => $user_name,
"user_password" => $user_password,
"site_name" => $config['site_name']
));
switch($config['account_activation']) {
case 2:
$email_template = "register_activation_admin";
$msg = $lang['register_success_admin'];
break;
case 1:
if ($config['language_dir_default'] != $config['language_dir']) {
$activation_url .= "&l=".$config['language_dir'];
}
$email_template = "register_activation";
$msg = $lang['register_success'];
break;
case 0:
default:
$email_template = "register_activation_none";
$msg = $lang['register_success_none'];
break;
}
$site_email->set_body($email_template, $config['language_dir']);
$site_email->send_email();
if ($config['account_activation'] == 2) {
$site_email->reset();
$site_email->set_to($config['site_email']);
$site_email->set_subject($lang['admin_activation_emailsubject']);
$user_details_url = $script_url."/admin/index.php?goto=".urlencode("users.php?action=edituser&user_id=".$user_id."&activation=1");
$site_email->register_vars("user_details_url", $user_details_url);
$site_email->set_body("admin_activation", $config['language_dir_default']);
$site_email->send_email();
}
}
ersetzte es mit:
if ($result) {
$activation_url = $script_url."/register.php?action=activate&activationkey=".$activationkey;
$email_to = $user_email;
$email_subject = $lang['register_success_emailsubject'];
$site_mailtemplate->register_vars(array(
"lang_user_name" => $lang['user_name'],
"lang_password" => $lang['password'],
"activation_url" => $activation_url,
"user_name" => $user_name,
"user_password" => $user_password,
"subject" => $email_subject
));
switch($config['account_activation']) {
case 2:
$email_template = "register_activation_admin_html";
$msg = $lang['register_success_admin'];
break;
case 1:
if ($config['language_dir_default'] != $config['language_dir']) {
$activation_url .= "&l=".$config['language_dir'];
}
$email_template = "register_activation_html";
$msg = $lang['register_success'];
break;
case 0:
default:
$email_template = "register_activation_none_html";
$msg = $lang['register_success_none'];
break;
}
$email_template = $email_template;
require(ROOT_PATH.'includes/email_bridge.php');
if ($config['account_activation'] == 2) {
$user_details_url = $script_url."/admin/index.php?goto=".urlencode("users.php?action=edituser&user_id=".$user_id."&activation=1");
$email_subject = $lang['admin_activation_emailsubject'];
$email_to = $config['site_email'];
$site_mailtemplate->register_vars(array(
"lang_profile" => $lang['profile'],
"lang_admin_activation_emailsubject" => $lang['admin_activation_emailsubject'],
"lang_user_name" => $lang['user_name'],
"lang_date" => $lang['date'],
"lang_email" => $lang['email'],
"user_email" => $user_email,
"current_date" => format_date($config['date_format']." ".$config['time_format'], time()),
"user_details_url" => $user_details_url,
"activation_url" => $activation_url,
"user_name" => $user_name,
"subject" => $email_subject
));
$email_template = "admin_activation_html";
require(ROOT_PATH.'includes/email_bridge.php');
}
}
5.1) suche:
if ($config['account_activation'] == 2) {
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($row[$user_table_fields['user_email']]);
$site_email->set_subject($lang['activation_success_emailsubject']);
$site_email->register_vars(array(
"user_name" => $row[$user_table_fields['user_name']],
"site_name" => $config['site_name']
));
$site_email->set_body("activation_success", $config['language_dir']);
$site_email->send_email();
}
ersetze es mit:
if ($config['account_activation'] == 2) {
$email_to = ($row[$user_table_fields['user_email']]);
$email_subject = ($lang['activation_success_emailsubject']);
$site_mailtemplate->register_vars(array(
"script_url" => $script_url."/index.php",
"user_name" => $row[$user_table_fields['user_name']],
"subject" => $email_subject,
));
$email_template = "activation_success_html";
include(ROOT_PATH.'includes/email_bridge.php');
}
6.) suche in postcard.php:
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to(stripslashes($recipient_email));
$site_email->set_from(stripslashes($sender_email), stripslashes($sender_name));
$site_email->set_subject($lang['send_postcard_emailsubject']);
$site_email->register_vars(array(
"sender_name" => stripslashes($sender_name),
"sender_email" => stripslashes($sender_email),
"recipient_name" => stripslashes($recipient_name),
"postcard_url" => stripslashes($postcard_url),
"postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
"site_name" => $config['site_name']
));
$site_email->set_body("postcard_message", $config['language_dir']);
$site_email->send_email();
ersetze es mit:
$file_path = TEMPLATE_DIR.'/'.$config['template_dir'].'/images/stamp.gif';
$file_name = "stamp.gif";
$email_to = (stripslashes($recipient_email));
$add_email_from = (stripslashes($sender_email));
$add_email_from_name = (stripslashes($sender_name));
$email_subject = $lang['send_postcard_emailsubject'];
$site_mailtemplate->register_vars(array(
"file_name" => $file_name,
"sender_name" => stripslashes($sender_name),
"sender_email" => stripslashes($sender_email),
"recipient_name" => stripslashes($recipient_name),
"postcard_url" => stripslashes($postcard_url),
"postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
"site_name" => $config['site_name'],
"subject" => $email_subject
));
$email_template = "postcard_message_html";
require(ROOT_PATH.'includes/email_bridge.php');
7.) suche in der gobal.php:
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");
füge darunter ein:
define('EMAIL_PATH', ROOT_PATH."lang/".$config['language_dir']."/email");
7.1) suche:
$site_template = new Template(TEMPLATE_PATH);
füge darunter ein:
$site_mailtemplate = new Template(EMAIL_PATH);
Anbei ein par Bilder wie es in Outlook ausieht.
mfg Andi