Sending MIME emails in last version of SuiteCRM

In later Versions then 7.1.4, i have problem when sending MIME emails, they are received perfectly, and checking the local sent folder they appear perfectly, but when checking the sent folder of the external IMAP account they are empty or blank…

I think it is a problem of PhpMailler in:

public function getMailMIME()
{

case ‘alt’:
case ‘alt_inline’:
$result .= $this->headerLine(‘Content-Type’, ‘multipart/alternative;’);
$result .= $this->textLine("\tboundary="" . $this->boundary[1] . ‘"’);
break;

public function createBody()
{

case ‘alt’:
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, ‘text/plain’, $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= $this->LE . $this->LE;
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, ‘text/html’, $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= $this->LE . $this->LE;
if (!empty($this->Ical)) {
$body .= $this->getBoundary($this->boundary[1], ‘’, ‘text/calendar; method=REQUEST’, ‘’);
$body .= $this->encodeString($this->Ical, $this->Encoding);
$body .= $this->LE . $this->LE;
}
$body .= $this->endBoundary($this->boundary[1]);
break;
case ‘alt_inline’:
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, ‘text/plain’, $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= $this->LE . $this->LE;
$body .= $this->textLine(’–’ . $this->boundary[1]);
$body .= $this->headerLine(‘Content-Type’, ‘multipart/related;’);
$body .= $this->textLine("\tboundary="" . $this->boundary[2] . ‘"’);
$body .= $this->LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, ‘text/html’, $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= $this->LE . $this->LE;
$body .= $this->attachAll(‘inline’, $this->boundary[2]);
$body .= $this->LE;
$body .= $this->endBoundary($this->boundary[1]);
break;

The boundary used = $this->boundary[1]

but in code of sent email is diferent:


X-Mailer: PHPMailer 5.2.13 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary=“b1_752eda803624f08833f5761db60c2844”

This is a multi-part message in MIME format.

–b1_7b408c1fc77dfcde2962c4cce472300d
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

MESSAGE

–b1_7b408c1fc77dfcde2962c4cce472300d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

=0A=0A=0A=

=0A=0A11:42=0A=0A

–b1_7b408c1fc77dfcde2962c4cce472300d–

Conclusion : boundary=“b1_752eda803624f08833f5761db60c2844” different --b1_7b408c1fc77dfcde2962c4cce472300d

Hi peleja, did you found a resolution ? I have a similar problem.

Thanks,

Jonathan

This error appeared after using a new version of PHPMailer (class.phpmailer.php file).
Earlier values “boundary =” calculated in forming the header and used in the body.

Now PHPMailer component of the new values of “boundary =” calculated in the message body.

Therefore, we get this:

  1. Called the function to create headers with the old value of “boundary =”;
  2. Called the function to create the message body with the new values “boundary =”

As a result, in a letter obtained by various “boundary =”

Here is the solution:


--- Email.php.old	2016-08-31 18:32:15.000000000 +0300
+++ Email.php	2016-09-26 16:27:52.326236929 +0300
@@ -935,7 +935,8 @@
 			if (isset($ie->id) && !$ie->isPop3Protocol() && $mail->oe->mail_smtptype != 'gmail') {
 				$sentFolder = $ie->get_stored_options("sentFolder");
 				if (!empty($sentFolder)) {
-					$data = $mail->CreateHeader() . "\r\n" . $mail->CreateBody() . "\r\n";
+					$bodytext=$mail->CreateBody();  // before CreateHeaders for generate new bounces
+					$data = $mail->CreateHeader() . "\r\n" . $bodytext . "\r\n";
 					$ie->mailbox = $sentFolder;
 					if ($ie->connectMailserver() == 'true') {
 						$connectString = $ie->getConnectString($ie->getServiceString(), $ie->mailbox);

Thanks feser! Your fix worked for me. Has this been reported as a bug? It would be ideal to have this change implemented upstream.

Thanks,

-Dan