From: Jan Schneider Date: Tue, 3 Feb 2009 12:58:00 +0000 (+0100) Subject: Make the mime message building work again with the current mime code. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8d7d6bcabbd82c81a228ab3185bd515a27f2fa68;p=horde.git Make the mime message building work again with the current mime code. --- diff --git a/framework/Mime/lib/Horde/Mime/Mail.php b/framework/Mime/lib/Horde/Mime/Mail.php index 662caf645..b5f8b9219 100644 --- a/framework/Mime/lib/Horde/Mime/Mail.php +++ b/framework/Mime/lib/Horde/Mime/Mail.php @@ -422,24 +422,30 @@ class Horde_Mime_Mail } /* Build mime message. */ - $mime = new Horde_Mime_Part(); + $body = null; if (!empty($this->_body) && !empty($this->_htmlBody)) { - $basepart = new Horde_Mime_Part(); - $basepart->setType('multipart/alternative'); + $body = new Horde_Mime_Part(); + $body->setType('multipart/alternative'); $this->_body->setDescription(_("Plaintext Version of Message")); - $basepart->addPart($this->_body); + $body->addPart($this->_body); $this->_htmlBody->setDescription(_("HTML Version of Message")); - $basepart->addPart($this->_htmlBody); - $mime->addPart($basepart); - $mime->setType('multipart/alternative'); + $body->addPart($this->_htmlBody); } elseif (!empty($this->_htmlBody)) { - $mime->addPart($this->_htmlBody); + $body = $this->_htmlBody; } elseif (!empty($this->_body)) { - $mime->addPart($this->_body); - $mime->setType('multipart/alternative'); + $body = $this->_body; } - foreach ($this->_parts as $mime_part) { - $mime->addPart($mime_part); + if (count($this->_parts)) { + $basepart = new Horde_Mime_Part(); + $basepart->setType('multipart/mixed'); + if ($body) { + $basepart->addPart($body); + } + foreach ($this->_parts as $mime_part) { + $basepart->addPart($mime_part); + } + } else { + $basepart = $body; } /* Check mailer configuration. */ @@ -451,8 +457,9 @@ class Horde_Mime_Mail } /* Send message. */ - return $mime->send(implode(', ', $this->_recipients), $this->_headers, - $this->_mailer_driver, $this->_mailer_params); + return $basepart->send(implode(', ', $this->_recipients), + $this->_headers, $this->_mailer_driver, + $this->_mailer_params); } /**