Search in sources :

Example 1 with AttachmentsInfo

use of com.zimbra.soap.mail.type.AttachmentsInfo in project zm-mailbox by Zimbra.

the class TestContentTransferEncoding method testBug98015.

/*
     * Tests that the message from bug 98015 retains the correct Content Transfer Encoding via the mechanism of
     * inferring it from the existing message referenced by the "origid" parameter.
     * This scenario also happens to test the case when a CTE header on a sub-part is inherited from the top-level.
     */
@Ignore("disabled until bug 98015 is fixed")
@Test
public void testBug98015() throws Exception {
    MimeMessage mimeMsg = new ZMimeMessage(JMSession.getSession(), new SharedByteArrayInputStream(getBug98015MimeString().getBytes()));
    ParsedMessage pm = new ParsedMessage(mimeMsg, true);
    DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
    Message msg = mbox.addMessage(null, pm, dopt, null);
    MsgToSend msgToSend = new MsgToSend();
    msgToSend.setOrigId(String.valueOf(msg.getId()));
    msgToSend.setReplyType("w");
    msgToSend.setSubject("Fwd: QP bug");
    msgToSend.setMimePart(MimePartInfo.createForContentTypeAndContent("text/plain", "\n\n----- Forwarded Message -----\nSubject: QP Bug\n\n\\รถ/\nid=577281"));
    AttachmentsInfo attach = new AttachmentsInfo();
    attach.addAttachment(new MimePartAttachSpec(String.valueOf(msg.getId()), "2"));
    msgToSend.setAttachments(attach);
    SendMsgRequest req = new SendMsgRequest();
    req.setMsg(msgToSend);
    MimeMessage parsed = sendForwardedMessage(req, msg);
    ZMimeMultipart mmp = (ZMimeMultipart) parsed.getContent();
    assertEquals("8bit", mmp.getBodyPart(0).getHeader("Content-Transfer-Encoding")[0]);
    assertEquals("base64", mmp.getBodyPart(1).getHeader("Content-Transfer-Encoding")[0]);
}
Also used : AttachmentsInfo(com.zimbra.soap.mail.type.AttachmentsInfo) ZMimeMessage(com.zimbra.common.zmime.ZMimeMessage) ZMimeMessage(com.zimbra.common.zmime.ZMimeMessage) Message(com.zimbra.cs.mailbox.Message) MimeMessage(javax.mail.internet.MimeMessage) ParseMimeMessage(com.zimbra.cs.service.mail.ParseMimeMessage) ZMimeMessage(com.zimbra.common.zmime.ZMimeMessage) MimeMessage(javax.mail.internet.MimeMessage) ParseMimeMessage(com.zimbra.cs.service.mail.ParseMimeMessage) ZMimeMultipart(com.zimbra.common.zmime.ZMimeMultipart) MsgToSend(com.zimbra.soap.mail.type.MsgToSend) SendMsgRequest(com.zimbra.soap.mail.message.SendMsgRequest) DeliveryOptions(com.zimbra.cs.mailbox.DeliveryOptions) SharedByteArrayInputStream(javax.mail.util.SharedByteArrayInputStream) MimePartAttachSpec(com.zimbra.soap.mail.type.MimePartAttachSpec) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ZMimeMessage (com.zimbra.common.zmime.ZMimeMessage)1 ZMimeMultipart (com.zimbra.common.zmime.ZMimeMultipart)1 DeliveryOptions (com.zimbra.cs.mailbox.DeliveryOptions)1 Message (com.zimbra.cs.mailbox.Message)1 ParseMimeMessage (com.zimbra.cs.service.mail.ParseMimeMessage)1 SendMsgRequest (com.zimbra.soap.mail.message.SendMsgRequest)1 AttachmentsInfo (com.zimbra.soap.mail.type.AttachmentsInfo)1 MimePartAttachSpec (com.zimbra.soap.mail.type.MimePartAttachSpec)1 MsgToSend (com.zimbra.soap.mail.type.MsgToSend)1 MimeMessage (javax.mail.internet.MimeMessage)1 SharedByteArrayInputStream (javax.mail.util.SharedByteArrayInputStream)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1