From 21235274b45c0bef9acc6f95beff0977f0bf2a9d Mon Sep 17 00:00:00 2001
From: till <till@php.net>
Date: Sat, 22 Mar 2008 09:55:33 -0400
Subject: [PATCH] * committing fix from #1484506

---
 program/steps/mail/sendmail.inc |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 21b5b43..7c729ff 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -245,6 +245,11 @@
   // add a plain text version of the e-mail as an alternative part.
   $h2t = new html2text($message_body);
   $plainTextPart = wordwrap($h2t->get_text(), 998, "\r\n", true);
+  if (!strlen($plainTextPart)) 
+    { 
+    // empty message body breaks attachment handling in drafts 
+    $plainTextPart = "\r\n"; 
+    }
   $MAIL_MIME->setTXTBody(html_entity_decode($plainTextPart, ENT_COMPAT, 'utf-8'));
 
   // look for "emoticon" images from TinyMCE and copy into message as attachments
@@ -254,6 +259,11 @@
   {
   $message_body = wordwrap($message_body, 75, "\r\n");
   $message_body = wordwrap($message_body, 998, "\r\n", true);
+  if (!strlen($message_body))  
+    { 
+    // empty message body breaks attachment handling in drafts 
+    $message_body = "\r\n"; 
+    } 
   $MAIL_MIME->setTXTBody($message_body, FALSE, TRUE);
   }
 

--
Gitblit v1.9.1