diff --git a/src/com/android/email/activity/MessageCompose.java b/src/com/android/email/activity/MessageCompose.java index aff49bdb8..429116c0a 100644 --- a/src/com/android/email/activity/MessageCompose.java +++ b/src/com/android/email/activity/MessageCompose.java @@ -675,9 +675,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc for (int i = 0, count = mAttachments.getChildCount(); i < count; i++) { Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag(); MimeBodyPart bp = new MimeBodyPart( new LocalStore.LocalAttachmentBody(attachment.uri, getApplication())); - bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"", attachment.contentType, attachment.name)); - bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64"); - bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format("attachment;\n filename=\"%s\"", attachment.name)); + bp.addHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"", attachment.contentType, attachment.name)); + bp.addHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64"); + bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format("attachment;\n filename=\"%s\"", attachment.name)); mp.addBodyPart(bp); } @@ -749,7 +749,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } Log.d(Email.LOG_TAG, "Saving identity: " + k9identity); - message.setHeader(Email.K9MAIL_IDENTITY, k9identity); + message.addHeader(Email.K9MAIL_IDENTITY, k9identity); MessagingController.getInstance(getApplication()).saveDraft(mAccount, message); mDraftUid = message.getUid(); diff --git a/src/com/android/email/mail/internet/MimeBodyPart.java b/src/com/android/email/mail/internet/MimeBodyPart.java index 539319b19..29ef87952 100644 --- a/src/com/android/email/mail/internet/MimeBodyPart.java +++ b/src/com/android/email/mail/internet/MimeBodyPart.java @@ -29,7 +29,7 @@ public class MimeBodyPart extends BodyPart { public MimeBodyPart(Body body, String mimeType) throws MessagingException { if (mimeType != null) { - setHeader(MimeHeader.HEADER_CONTENT_TYPE, mimeType); + addHeader(MimeHeader.HEADER_CONTENT_TYPE, mimeType); } setBody(body); } @@ -72,6 +72,10 @@ public class MimeBodyPart extends BodyPart { contentType += String.format(";\n name=\"%s\"", name); } setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType); + //TODO: Use quoted-printable + //using org.apache.commons.codec.net.QuotedPrintableCodec + //when it will implement all rules (missing #3, $4 & #5) of the RFC + //http://www.ietf.org/rfc/rfc1521.txt setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64"); } } diff --git a/src/com/android/email/mail/internet/MimeMessage.java b/src/com/android/email/mail/internet/MimeMessage.java index a2cb08029..3b1570bb1 100644 --- a/src/com/android/email/mail/internet/MimeMessage.java +++ b/src/com/android/email/mail/internet/MimeMessage.java @@ -44,9 +44,8 @@ public class MimeMessage extends Message { protected int mSize; public MimeMessage() { - setHeader("Message-ID", generateMessageId()); - - } + addHeader("Message-ID", generateMessageId()); + } private String generateMessageId() { StringBuffer sb = new StringBuffer(); diff --git a/src/com/android/email/mail/store/LocalStore.java b/src/com/android/email/mail/store/LocalStore.java index 6c00b32be..a68dab510 100644 --- a/src/com/android/email/mail/store/LocalStore.java +++ b/src/com/android/email/mail/store/LocalStore.java @@ -916,7 +916,7 @@ public class LocalStore extends Store implements Serializable { message.setReplyTo(Address.unpack(cursor.getString(9))); message.mAttachmentCount = cursor.getInt(10); message.setInternalDate(new Date(cursor.getLong(11))); - message.setHeader("Message-ID", cursor.getString(12)); + message.addHeader("Message-ID", cursor.getString(12)); } @Override