Search in sources :

Example 1 with AttachementMap

use of com.dexels.navajo.adapter.mailmap.AttachementMap in project navajo by Dexels.

the class MailMapAlternative method main.

public static void main(String[] args) throws UserException {
    MailMapAlternative mma = new MailMapAlternative();
    mma.setMailServer("mail.dexels.com");
    mma.setSubject("Test");
    mma.setSender("arnoud@dexels.com");
    mma.setRecipients("arnoud@dexels.com");
    AttachementMap am = new AttachementMap();
    am.setAttachFileName("attachment.png");
    am.setEncoding("base64");
    am.setAttachFile("c:/feyenoord-goud.png");
    mma.setAttachment(am);
    AttachementMap bm = new AttachementMap();
    bm.setAttachFileName("bodypart.png");
    bm.setEncoding("base64");
    bm.setAttachFile("c:/feyenoord-goud.png");
    mma.setRelatedBodyPart(bm);
    mma.setContentType("text/html");
    mma.setText("<html><head> </head><body>Test<img src=\"cid:attach-nr-0\"></body></html>");
    mma.send();
}
Also used : AttachementMap(com.dexels.navajo.adapter.mailmap.AttachementMap)

Example 2 with AttachementMap

use of com.dexels.navajo.adapter.mailmap.AttachementMap in project navajo by Dexels.

the class TestMailResource method testAttach.

@Test
@Ignore
public void testAttach() throws MappableException, UserException {
    ResourceMailAdapter rma = new ResourceMailAdapter();
    try {
        rma.load(new Access());
        rma.setRecipients("dexels@gmail.com");
        rma.setSender("dexels@gmail.com");
        rma.setSubject("Attachment at " + new Date());
        AttachementMap am = new AttachementMap();
        am.setAttachContentType("image/jpeg");
        am.setAttachContentDisposition("inline");
        am.setAttachFileContent(new Binary(getClass().getResourceAsStream("monkey.jpeg")));
        rma.setAttachment(am);
        rma.setResourceName("junit.mail");
        rma.store();
    } catch (UserException e) {
        Assert.assertEquals("javax.mail.AuthenticationFailedException", e.getCause().toString());
    }
}
Also used : Access(com.dexels.navajo.script.api.Access) AttachementMap(com.dexels.navajo.adapter.mailmap.AttachementMap) Binary(com.dexels.navajo.document.types.Binary) UserException(com.dexels.navajo.script.api.UserException) Date(java.util.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

AttachementMap (com.dexels.navajo.adapter.mailmap.AttachementMap)2 Binary (com.dexels.navajo.document.types.Binary)1 Access (com.dexels.navajo.script.api.Access)1 UserException (com.dexels.navajo.script.api.UserException)1 Date (java.util.Date)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1