Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6d29cb1 authored by cketti's avatar cketti
Browse files

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

parent 8049e90b
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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);
                    }
                }
            }
        }
+5 −4
Original line number Diff line number Diff line
@@ -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.");