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

                // against "text/html;" If it is more specific then leave as is,
                // if it is different then use the mime type specified in the
                // attachment
                if( messageMimeType != null &&
                        bodyMimeType.indexOf( messageMimeType ) == -1 ) {
                    bodyPart.addHeader( "Content-Type", messageMimeType );
                }
            } catch( Exception e ) {
                // Here we have failed to correct the mime type if required.
                // Leave the bodyPart as is and continue as this is not critical
                logger.warn( "attachment-mime-type-assignment-failure", e );
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);
                    // Set Disposition
                    messageBodyPart.setDisposition(partDisposition);
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

        }
        messageBodyPart = new MimeBase64BodyPart();
        messageBodyPart.setDataHandler(new DataHandler(source));
        messageBodyPart.setDisposition(Part.ATTACHMENT);

        messageBodyPart
                .addHeader("Content-Description", "\"" + mailToInfo.getContentDescription() + "\"");

        String contentType = format.getContentType() != null ? format.getContentType() :
                Constants.DEFAULT_CONTENT_TYPE;
        if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
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

                    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

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.