Hi All,
SugarCRM $mailer->setHtmlBody($body) function not working when description field of task module contains formatted text without html tags.
Steps to reproduce:
1. Create Task record with description field value as below:
"Dear Sugar Administrator,
On XXX, XXX Xth 1555 , beginning Time, SugarCRM will be performing maintenance. Maintenance is expected to be complete.
Please note that this only affect you if you are using tXXX service."
2. Create email temaplte and add description field in template.
3. Try to send email using custom code as below:
"
try{
$oTemplate = new EmailTemplate();
$oMail = MailerFactory::getSystemDefaultMailer();
$mailTransmissionProtocol = $oMail->getMailTransmissionProtocol();
$oTemplate->retrieve_by_string_fields(array('name' => "Temaplate Name", 'type' => 'email'));
$oMail->clearRecipients();
$oMail->addRecipientsTo(new EmailIdentity("Test@email.com","Test User"));
$body = trim($oTemplate->body_html);
$oMail->setHtmlBody($body);
$oMail->Send()
}catch(MailerException $me) {
$message = $me->getMessage();
$GLOBALS["log"]->fatal(
"Send Email: error sending e-mail (method: {$mailTransmissionProtocol}), (error: {$message})"
);
}
"
4. check received email now:
"
Description :
Dear Sugar Administrator, On XXX, XXX Xth 1555 , beginning Time, SugarCRM will be performing maintenance. Maintenance is expected to be complete. Please note that this only affect you if you are using tXXX service.
"
But expected output was :
"Description :
Dear Sugar Administrator,
On XXX, XXX Xth 1555 , beginning Time, SugarCRM will be performing maintenance. Maintenance is expected to be complete.
Please note that this only affect you if you are using tXXX service.
"
Thanks,
Shreya