Skip to content
Snippets Groups Projects
Commit e37ec74d authored by Jared Hancock's avatar Jared Hancock
Browse files

mailer: Pick content_ids that Mail_Mime will enjoy

parent c0f49c64
Branches
Tags
No related merge requests found
...@@ -162,10 +162,14 @@ class Mailer { ...@@ -162,10 +162,14 @@ class Mailer {
$isHtml = false; $isHtml = false;
} }
$domain = 'local';
if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) { if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) {
// TODO: Lookup helpdesk domain // Pick a domain compatible with pear Mail_Mime
$domain = substr(md5($ost->getConfig()->getURL()), -12); $matches = array();
if (preg_match('#(@[0-9a-zA-Z\-\.]+)#', $this->getFromAddress(), $matches)) {
$domain = $matches[1];
} else {
$domain = '@localhost';
}
// Format content-ids with the domain, and add the inline images // Format content-ids with the domain, and add the inline images
// to the email attachment list // to the email attachment list
$self = $this; $self = $this;
...@@ -175,10 +179,10 @@ class Mailer { ...@@ -175,10 +179,10 @@ class Mailer {
return $match[0]; return $match[0];
$mime->addHTMLImage($file->getData(), $mime->addHTMLImage($file->getData(),
$file->getType(), $file->getName(), false, $file->getType(), $file->getName(), false,
$match[1].'@'.$domain); $match[1].$domain);
// Don't re-attach the image below // Don't re-attach the image below
unset($self->attachments[$file->getId()]); unset($self->attachments[$file->getId()]);
return $match[0].'@'.$domain; return $match[0].$domain;
}, $message); }, $message);
// Add an HTML body // Add an HTML body
$mime->setHTMLBody($message); $mime->setHTMLBody($message);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment