1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-04 16:45:09 -05:00

Fixes issue 21 (All messages are turned into multipart messages)

This commit is contained in:
cketti 2010-02-03 19:56:20 +00:00
parent 8049e90b8c
commit c6d29cb10e
2 changed files with 17 additions and 6 deletions

View File

@ -1139,10 +1139,8 @@ public class LocalStore extends Store implements Serializable
{ {
LocalMessage localMessage = (LocalMessage)message; LocalMessage localMessage = (LocalMessage)message;
Cursor cursor = null; Cursor cursor = null;
localMessage.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "multipart/mixed");
MimeMultipart mp = new MimeMultipart(); MimeMultipart mp = new MimeMultipart();
mp.setSubType("mixed"); mp.setSubType("mixed");
localMessage.setBody(mp);
try try
{ {
cursor = mDb.rawQuery("SELECT html_content, text_content FROM messages " cursor = mDb.rawQuery("SELECT html_content, text_content FROM messages "
@ -1232,6 +1230,18 @@ public class LocalStore extends Store implements Serializable
cursor.close(); cursor.close();
} }
} }
if (mp.getCount() == 1)
{
BodyPart part = mp.getBodyPart(0);
localMessage.setHeader(MimeHeader.HEADER_CONTENT_TYPE, part.getContentType());
localMessage.setBody(part.getBody());
}
else
{
localMessage.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "multipart/mixed");
localMessage.setBody(mp);
}
} }
} }
} }

View File

@ -304,10 +304,11 @@ public class SmtpTransport extends Transport
} }
message.setRecipients(RecipientType.BCC, null); message.setRecipients(RecipientType.BCC, null);
executeSimpleCommand("DATA"); executeSimpleCommand("DATA");
// TODO byte stuffing EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
message.writeTo( new BufferedOutputStream(mOut, 1024));
new EOLConvertingOutputStream( message.writeTo(msgOut);
new BufferedOutputStream(mOut, 1024))); // We use BufferedOutputStream. So make sure to call flush() !
msgOut.flush();
possibleSend = true; // After the "\r\n." is attempted, we may have sent the message possibleSend = true; // After the "\r\n." is attempted, we may have sent the message
executeSimpleCommand("\r\n."); executeSimpleCommand("\r\n.");