1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Fix for images in mail preview.

This commit is contained in:
Cameron
2014-10-18 05:18:51 -07:00
parent f689d6ae9c
commit 5a2ce38e08
2 changed files with 15 additions and 8 deletions

View File

@@ -591,13 +591,14 @@ class mailout_main_ui extends e_admin_ui
function previewPage()
{
$mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($_GET['id'])." LIMIT 1");
$data = $this->mailAdmin->dbToMail($mailData);
$eml = array(
'body' => $data['mail_body'],
'template' => $data['mail_send_style']
'subject' => $data['mail_subject'],
'body' => $data['mail_body'],
'template' => $data['mail_send_style'],
'shortcodes' => array('USERNAME'=>'John Example', 'DISPLAYNAME'=> 'John Example', 'USERID'=>'555', 'UNSUBSCRIBE'=>SITEURL."unsubscribe/?id=example1234567")
);
return e107::getEmail()->preview($eml);
@@ -1284,9 +1285,10 @@ class mailout_admin_form_ui extends e_admin_form_ui
{
$text = "";
$link = e_SELF."?mode=main&action=send&id=".$id;
$preview = e_SELF."?mode=main&action=preview&id=".$id;
$text .= "<a href='".$link."' class='btn' title='Send Mail'>".E_32_MAIL."</a>";
$text .= "<a rel='external' class='btn e-modal' data-modal-caption='Email preview' href='".$preview."' class='btn' title='Preview'>".E_32_SEARCH."</a>";
$text .= $this->renderValue('options',$value,$att,$id);
return $text;

View File

@@ -156,7 +156,7 @@ class e107Email extends PHPMailer
public $legacyBody = false; // TRUE enables legacy conversion of plain text body to HTML in HTML emails
private $debug = false; // echos various debug info when set to true.
private $pref = array(); // Store code prefs.
private $previewMode = false;
/**
* Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed
*
@@ -525,7 +525,10 @@ class e107Email extends PHPMailer
$message = str_replace("\r","\n",$message); // Handle alternative newline characters
$message = str_replace("\n", "<br />\n", $message);
}
$this->MsgHTML($message); // Theoretically this should do everything, including handling of inline images.
}
else
{ // generate the plain text as the sole part of the email
@@ -600,6 +603,8 @@ class e107Email extends PHPMailer
*/
public function preview($eml)
{
$this->previewMode = true;
if (count($eml))
{
if($error = $this->arraySet($eml)) // Set parameters from list
@@ -888,7 +893,7 @@ class e107Email extends PHPMailer
preg_match_all("/(src|background)=([\"\'])(.*)\\2/Ui", $message, $images); // Modified to accept single quotes as well
if(isset($images[3]))
if(isset($images[3]) && ($this->previewMode === false))
{
if($this->debug)