Package javax.mail

Examples of javax.mail.BodyPart.addHeader()


                    messageBodyPart.setDataHandler(handler);

                    if (attachmentFilename.toLowerCase().startsWith("cid:")) {
                        // add a Content-ID header to the attachment
                        // must use angle brackets according to RFC: http://www.ietf.org/rfc/rfc2392.txt
                        messageBodyPart.addHeader("Content-ID", "<" + attachmentFilename.substring(4) + ">");
                        // Set the filename without the cid
                        messageBodyPart.setFileName(attachmentFilename.substring(4));
                    } else {
                        // Set the filename
                        messageBodyPart.setFileName(attachmentFilename);
View Full Code Here


                    messageBodyPart.setDataHandler(handler);

                    if (attachmentFilename.toLowerCase().startsWith("cid:")) {
                        // add a Content-ID header to the attachment
                        // must use angle brackets according to RFC: http://www.ietf.org/rfc/rfc2392.txt
                        messageBodyPart.addHeader("Content-ID", "<" + attachmentFilename.substring(4) + ">");
                        // Set the filename without the cid
                        messageBodyPart.setFileName(attachmentFilename.substring(4));
                    } else {
                        // Set the filename
                        messageBodyPart.setFileName(attachmentFilename);
View Full Code Here

                    // Set the data handler to the attachment
                    messageBodyPart.setDataHandler(handler);
                   
                    if (attachmentFilename.toLowerCase().startsWith("cid:")) {
                        // add a Content-ID header to the attachment
                        messageBodyPart.addHeader("Content-ID", attachmentFilename.substring(4));
                    }

                    // Set the filename
                    messageBodyPart.setFileName(attachmentFilename);
                    LOG.trace("Attachment #" + i + ": ContentType: " + messageBodyPart.getContentType());
View Full Code Here

                    messageBodyPart.setDataHandler(handler);

                    if (attachmentFilename.toLowerCase().startsWith("cid:")) {
                        // add a Content-ID header to the attachment
                        // must use angle brackets according to RFC: http://www.ietf.org/rfc/rfc2392.txt
                        messageBodyPart.addHeader("Content-ID", "<" + attachmentFilename.substring(4) + ">");
                        // Set the filename without the cid
                        messageBodyPart.setFileName(attachmentFilename.substring(4));
                    } else {
                        // Set the filename
                        messageBodyPart.setFileName(attachmentFilename);
View Full Code Here

    BodyPart html = new MimeBodyPart();
    html.setDataHandler(new DataHandler(new ByteArrayDataSource(m.getBody(), "text/html; charset=UTF-8")));
    multiBody.addBodyPart(html);

    BodyPart iCalContent = new MimeBodyPart();
    iCalContent.addHeader("content-class", "urn:content-classes:calendarmessage");
    iCalContent.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(m.getIcs()),
        "text/calendar; charset=UTF-8; method=REQUEST")));
    multiBody.addBodyPart(iCalContent);
    BodyPart body = new MimeBodyPart();
    body.setContent(multiBody);
View Full Code Here

   
    BodyPart iCalAttachment = new MimeBodyPart();
    iCalAttachment.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(m.getIcs()),
        "application/ics")));
    iCalAttachment.removeHeader("Content-Transfer-Encoding");
    iCalAttachment.addHeader("Content-Transfer-Encoding", "base64");
    iCalAttachment.removeHeader("Content-Type");
    iCalAttachment.addHeader("Content-Type", "application/ics");
    iCalAttachment.setFileName("invite.ics");
    multipart.addBodyPart(iCalAttachment);
View Full Code Here

    iCalAttachment.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(m.getIcs()),
        "application/ics")));
    iCalAttachment.removeHeader("Content-Transfer-Encoding");
    iCalAttachment.addHeader("Content-Transfer-Encoding", "base64");
    iCalAttachment.removeHeader("Content-Type");
    iCalAttachment.addHeader("Content-Type", "application/ics");
    iCalAttachment.setFileName("invite.ics");
    multipart.addBodyPart(iCalAttachment);

    msg.setContent(multipart);
    return msg;
View Full Code Here

                    messageBodyPart.setDataHandler(handler);

                    if (attachmentFilename.toLowerCase().startsWith("cid:")) {
                        // add a Content-ID header to the attachment
                        // must use angle brackets according to RFC: http://www.ietf.org/rfc/rfc2392.txt
                        messageBodyPart.addHeader("Content-ID", "<" + attachmentFilename.substring(4) + ">");
                        // Set the filename without the cid
                        messageBodyPart.setFileName(attachmentFilename.substring(4));
                    } else {
                        // Set the filename
                        messageBodyPart.setFileName(attachmentFilename);
View Full Code Here

    BodyPart html = new MimeBodyPart();
    html.setDataHandler(new DataHandler(new ByteArrayDataSource(m.getBody(), "text/html; charset=UTF-8")));
    multiBody.addBodyPart(html);

    BodyPart iCalContent = new MimeBodyPart();
    iCalContent.addHeader("content-class", "urn:content-classes:calendarmessage");
    iCalContent.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(m.getIcs()),
        "text/calendar; charset=UTF-8; method=REQUEST")));
    multiBody.addBodyPart(iCalContent);
    BodyPart body = new MimeBodyPart();
    body.setContent(multiBody);
View Full Code Here

   
    BodyPart iCalAttachment = new MimeBodyPart();
    iCalAttachment.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(m.getIcs()),
        "application/ics")));
    iCalAttachment.removeHeader("Content-Transfer-Encoding");
    iCalAttachment.addHeader("Content-Transfer-Encoding", "base64");
    iCalAttachment.removeHeader("Content-Type");
    iCalAttachment.addHeader("Content-Type", "application/ics");
    iCalAttachment.setFileName("invite.ics");
    multipart.addBodyPart(iCalAttachment);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.