Exemple #1
0
 /**
  * Retrieve function from handlebody() to unit test easily
  * @param SugarPHPMailer $mail SugarPHPMailer instance
  * @return formatted $mail body
  */
 function handleBodyInHTMLformat($mail)
 {
     global $sugar_config;
     // wp: if body is html, then insert new lines at 996 characters. no effect on client side
     // due to RFC 2822 which limits email lines to 998
     $mail->IsHTML(true);
     $body = from_html(wordwrap($this->description_html, 996));
     $mail->Body = $body;
     // cn: bug 9725
     // new plan is to use the selected type (html or plain) to fill the other
     $plainText = from_html($this->description_html);
     $plainText = strip_tags(br2nl($plainText));
     $mail->AltBody = $plainText;
     $this->description = $plainText;
     $mail->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/"));
     //Replace any embeded images using the secure entryPoint for src url.
     $mail->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?index.php[?]entryPoint=download&(?:amp;)?[^\"]+?id=", "upload://", true);
     $mail->Body = from_html($mail->Body);
 }