From 3de9381d6063d069dc2be64bc51771d64958d658 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 13 May 2015 02:03:36 -0700 Subject: [PATCH] More mail fixes. --- e107_admin/mailout.php | 57 ++++++++++++++++++-------- e107_core/templates/email_template.php | 2 +- e107_handlers/mail.php | 2 +- e107_handlers/mailout_admin_class.php | 8 ++-- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index bcd1811ac..eb8aa3e08 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -480,8 +480,14 @@ class mailout_main_ui extends e_admin_ui 'subject' => LAN_MAILOUT_113." ".$add, 'body' => str_replace("[br]", "\n", LAN_MAILOUT_114), 'template' => vartrue($_POST['testtemplate'],null), - 'shortcodes' => array('USERID'=>555, 'USERNAME'=>'John Smith', 'LOGINNAME'=>'TestName', 'PASSWORD'=>'xxxxxxx', 'ACTIVATION_LINK'=>SITEURL."signup.php#activate"), - ); + 'shortcodes' => $this->getExampleShortcodes(), + 'media' => array( + 0 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'), + 1 => array('path' => 'h-v880sXEOQ.youtube'), + + ) + + ); if(E107_DEBUG_LEVEL > 0) { @@ -691,27 +697,14 @@ class mailout_main_ui extends e_admin_ui else { e107::coreLan('signup'); - + $tp = e107::getParser(); + $eml = array( 'subject' => 'Test Subject', 'body' => "This is the body text of your email. Included are example media attachments such as images and video thumbnails.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam volutpat risus, a efficitur ex dignissim ac. Phasellus ornare tortor est, a elementum orci finibus non! Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce feugiat bibendum venenatis. Ut sit amet purus id magna consequat euismod vitae ac elit. Maecenas rutrum nisi metus, sed pulvinar velit fermentum eu? Aliquam erat volutpat.
Ut risus massa, consequat et gravida vitae, tincidunt in metus. Nam sodales felis non tortor faucibus lacinia! Integer neque libero, maximus eu cursus nec, fringilla varius erat. Phasellus elementum scelerisque mauris at fermentum. Aliquam erat volutpat. Aliquam sit amet placerat leo, vitae mollis purus. Nulla laoreet nulla pretium risus placerat, a luctus risus pulvinar. Duis ut dolor sed arcu aliquam dictum sed auctor magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam eleifend in mi lobortis blandit. Aliquam vestibulum rhoncus vestibulum. Cras metus.", 'template' => $id, - 'shortcodes' => array( - - 'USERNAME' =>'test-username', - 'EMAIL' => 'test@email.com', - 'DISPLAYNAME' => 'John Example', - 'USERID' =>'555', - 'MAILREF' => '123', - 'NEWSLETTER' => SITEURL."newsletter/?id=example1234567", - 'UNSUBSCRIBE' => SITEURL."unsubscribe.php?id=example1234567", - 'UNSUBSCRIBE_MESSAGE'=> "This email was sent to test@email.com. If you don't want to receive these emails in the future, please unsubscribe. ", - 'ACTIVATION_LINK' => "http://whereever.to.activate.com/", - 'USERURL' => "www.user-website.com", - 'PASSWORD' => "test-password", - 'LOGINNAME' => "test-loginname" - ), + 'shortcodes' => $this->getExampleShortcodes(), 'media' => array( 0 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'), 1 => array('path' => 'h-v880sXEOQ.youtube'), @@ -726,6 +719,34 @@ class mailout_main_ui extends e_admin_ui return e107::getEmail()->preview($eml); exit; + } + + + function getExampleShortcodes() + { + $tp = e107::getParser(); + + return array( + + 'USERNAME' =>'test-username', + 'EMAIL' => 'test@email.com', + 'DISPLAYNAME' => 'John Example', + 'USERID' =>'555', + 'MAILREF' => '123', + 'NEWSLETTER' => SITEURL."newsletter/?id=example1234567", + 'UNSUBSCRIBE' => SITEURL."unsubscribe.php?id=example1234567", + 'UNSUBSCRIBE_MESSAGE'=> "This email was sent to test@email.com. If you don't want to receive these emails in the future, please unsubscribe. ", + 'ACTIVATION_LINK' => "http://whereever.to.activate.com/", + 'USERURL' => "www.user-website.com", + 'PASSWORD' => "test-password", + 'LOGINNAME' => "test-loginname", + 'SUBJECT' => "Test Subject", + 'DATE_SHORT' => $tp->toDate(time(),'short'), + 'DATE_LONG' => $tp->toDate(time(),'long'), + ); + + + } function templatesPage() diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index dad45d30c..fa8f2f39b 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -193,7 +193,7 @@ $EMAIL_TEMPLATE['quickadduser']['footer'] = $EMAIL_TEMPLATE['default']['footer' // ------- Notify (@see admin-> notify) - +$EMAIL_TEMPLATE['notify']['name'] = 'Notify'; $EMAIL_TEMPLATE['notify']['subject'] = '{SITENAME}: {SUBJECT} '; $EMAIL_TEMPLATE['notify']['header'] = " diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index 19c7ca126..034e409c3 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -542,7 +542,7 @@ class e107Email extends PHPMailer if ($want_HTML !== FALSE) { - $message = e107::getParser()->toHtml("[html]".$message."[/html]",true); + // $message = e107::getParser()->toHtml("[html]".$message."[/html]",true); // using toHtml will break media attachment links. (need to retain {e_XXXX ) if ($this->debug) echo "Generating multipart email
"; if ($add_HTML_header) diff --git a/e107_handlers/mailout_admin_class.php b/e107_handlers/mailout_admin_class.php index 44ead7f26..b074d4f2b 100644 --- a/e107_handlers/mailout_admin_class.php +++ b/e107_handlers/mailout_admin_class.php @@ -833,7 +833,7 @@ class mailoutAdminClass extends e107MailManager { // Can be a template name now $errList[] = LAN_MAILOUT_205; - break; + // break; } else { @@ -914,7 +914,7 @@ class mailoutAdminClass extends e107MailManager $text .= $this->getUserName($val); break; case 'sdatetime': - $text .= $gen->convert_date($val, 'short'); + $text .= $tp->toDate($val, 'short'); break; case 'trunc200': @@ -1244,6 +1244,8 @@ class mailoutAdminClass extends e107MailManager { $mes = e107::getMessage(); $ns = e107::getRender(); + $frm = e107::getForm(); + $mailData = $this->retrieveEmail($mailId); @@ -1254,7 +1256,7 @@ class mailoutAdminClass extends e107MailManager exit ; } - $text .= " + $text = "