1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -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;
Cursor cursor = null;
localMessage.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "multipart/mixed");
MimeMultipart mp = new MimeMultipart();
mp.setSubType("mixed");
localMessage.setBody(mp);
try
{
cursor = mDb.rawQuery("SELECT html_content, text_content FROM messages "
@ -1232,6 +1230,18 @@ public class LocalStore extends Store implements Serializable
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);
executeSimpleCommand("DATA");
// TODO byte stuffing
message.writeTo(
new EOLConvertingOutputStream(
new BufferedOutputStream(mOut, 1024)));
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
new BufferedOutputStream(mOut, 1024));
message.writeTo(msgOut);
// 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
executeSimpleCommand("\r\n.");