Package javax.mail.internet

Examples of javax.mail.internet.MimeMessage.writeTo()


                }
                if ( articleID == null ) {
                    articleID = articleIDRepo.generateArticleID();
                    msg.setHeader("Message-Id", articleID);
                    FileOutputStream fout = new FileOutputStream(f);
                    msg.writeTo(fout);
                    fout.close();
                }
            }

            String[] headers = msg.getHeader("Newsgroups");
View Full Code Here


public class DumpSystemErr extends GenericMailet {

    public void service(Mail mail) throws MessagingException {
        try {
            MimeMessage message = mail.getMessage();
            message.writeTo(System.err);
        } catch (IOException ioe) {
            log("error printing message", ioe);
        }
    }
View Full Code Here

            // write out the multipart (we need to use mime message trying to
            // encode directly with multipart or BodyPart does not set properly
            // the encodings and binary files gets ruined
            MimeMessage message = new GeoServerMimeMessage();
            message.setContent(multipart);
            message.writeTo(output);
            output.flush();
        } catch (MessagingException e) {
            throw new WcsException("Error occurred while encoding the mime multipart response", e);
        }
    }
View Full Code Here

    public void writeTo( OutputStream out ) {
        MimeMessage mm = new MimeMessage( (Session) null );
        factory.toMimeMessage( message, mm );
        try {
            mm.writeTo( out );
        } catch( IOException ex ) {
            throw new RuntimeException( ex );
        } catch( MessagingException ex ) {
            throw new RuntimeException( ex );
        }
View Full Code Here

            // Now write the message to the output stream
            try {
                outputStream =
                    context.getEnvironmentContext().getResponseOutputStream();

                message.writeTo(outputStream);

                // Force the output through to the stream
                // @todo copied from Shaun's example code; probably not needed
                outputStream.flush();
            } catch (MarinerContextException e) {
View Full Code Here

                return;
            }

            clearAllHeaders(message);

            message.writeTo(baos);

            BufferedReader br = new BufferedReader(new StringReader(baos.toString()));

            // this is synchronized to avoid concurrent update of the corpus
            synchronized (JDBCBayesianAnalyzer.DATABASE_LOCK) {
View Full Code Here

        MimeMessage mmNew = new MimeMessage(Session
                .getDefaultInstance(new Properties()),
                new ByteArrayInputStream(mimeSource.getBytes("UTF-8")));

        mmNew.writeTo(System.out);
        mail.setMessage(mmNew);
       
        recover.service(mail);

        assertTrue(mail.getMessage().getContent() instanceof MimeMultipart);
View Full Code Here

            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            double probability;

            if (message.getSize() < getMaxSize()) {
                message.writeTo(baos);
                probability = analyzer.computeSpamProbability(new BufferedReader(new StringReader(baos.toString())));
            } else {
                probability = 0.0;
            }
View Full Code Here

     * @throws MessagingException if an error occurs while writing the message
     */
    public void service(Mail mail) throws MessagingException {
        try {
            MimeMessage message = mail.getMessage();
            message.writeTo(System.err);
        } catch (IOException ioe) {
            log("error printing message", ioe);
        }
    }

View Full Code Here

            // get the "stream" socket and the related (buffered) output stream
            streamSocket = new Socket(socket.getInetAddress(), streamPort);
            bos = new BufferedOutputStream(streamSocket.getOutputStream(), getStreamBufferSize());
           
            // stream out the message to the scanner
            mimeMessage.writeTo(bos);
            bos.flush();
            bos.close();
            streamSocket.close();
           
            String answer;
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.