Package javax.mail.internet

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


                        articleID = articleIDRepo.generateArticleID();
                        msg.setHeader("Message-Id", articleID);
                    }
                    FileOutputStream fout = new FileOutputStream(spoolFile);
                    try {
                        msg.writeTo(fout);
                    } finally {
                        IOUtil.shutdownStream(fout);
                    }
                }
            }
View Full Code Here


                        if( !tmpfile.createNewFile())
                        {
                            throw new MessagingException("Temporary file already exists");
                        }
                        OutputStream out = new BufferedOutputStream(new FileOutputStream(tmpfile));
                        src.writeTo(out); // write message to tmp/tmpname
                        out.close(); // flush and close
                        File file = new File(seen ? this.curdir.dir
                                                 : this.newdir.dir, tmpname);
                        tmpfile.renameTo(file); // link to final location
                        tmpfile.delete(); // delete temporary file
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream(8 * 1024);
        reqMessage.writeTo(out);
        msg.setContent(out.toString(), reqMessage.getContentType(msgContext.getSOAPConstants()));

        ByteArrayOutputStream out2 = new ByteArrayOutputStream(8 * 1024);
        msg.writeTo(out2);

        client.setSender(fromAddress);
        System.out.print(client.getReplyString());
        client.addRecipient(toAddress);
        System.out.print(client.getReplyString());
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream(8 * 1024);
        output.writeTo(out);
        msg.setContent(out.toString(), output.getContentType(msgContext.getSOAPConstants()));

        ByteArrayOutputStream out2 = new ByteArrayOutputStream(8 * 1024);
        msg.writeTo(out2);

        client.setSender(sendFrom);
        System.out.print(client.getReplyString());
        client.addRecipient(replyTo);
        System.out.print(client.getReplyString());
View Full Code Here

                try {
                    int index = Integer.parseInt(i);
                    printWriter.println(MailSrvConstants.OK);
                    MimeMessage m = (MimeMessage) messages.get(index - 1);

                    m.writeTo(socket.getOutputStream());
                    //System.out.println("\n\n\n\n ========This is the mail========");
                    //m.writeTo(System.out);//socket.getOutputStream());
                    //System.out.println("\n\n\n\n ========This is the mail========");

                    socket.getOutputStream().write(CR_LF_DOT_CR_LF);// This is a bit of a hack to get it working. Have to find a bette way to handle this.
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream(8 * 1024);
        output.writeTo(out);
        msg.setContent(out.toString(), output.getContentType(msgContext.getSOAPConstants()));

        ByteArrayOutputStream out2 = new ByteArrayOutputStream(8 * 1024);
        msg.writeTo(out2);

        client.setSender(sendFrom);
        System.out.print(client.getReplyString());
        client.addRecipient(replyTo);
        System.out.print(client.getReplyString());
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream(8 * 1024);
        reqMessage.writeTo(out);
        msg.setContent(out.toString(), reqMessage.getContentType(msgContext.getSOAPConstants()));

        ByteArrayOutputStream out2 = new ByteArrayOutputStream(8 * 1024);
        msg.writeTo(out2);

        client.setSender(fromAddress);
        System.out.print(client.getReplyString());
        client.addRecipient(toAddress);
        System.out.print(client.getReplyString());
View Full Code Here

                    printWriter.println(Constants.OK);

                    MimeMessage m = (MimeMessage) messages.get(index - 1);

                    m.writeTo(socket.getOutputStream());

                    socket.getOutputStream().write(CR_LF_DOT_CR_LF);    // This is a bit of a hack to get it working. Have to find a bette way to handle this.
                    socket.getOutputStream().flush();
                } catch (NumberFormatException e) {
                    printWriter.println(Constants.ERR);
View Full Code Here

                    super.write(b);
                }
            }
        };
        // Write
        mime.writeTo(os, headers);
    }

    public void writeSoapEnvelope(XMLStreamWriter writer) throws Exception {
        QName envelope = getEnvelopeName();
        String soapUri = envelope.getNamespaceURI();
View Full Code Here

        mmorig = null;
        System.gc();
        Thread.sleep(200);

        try {
            mm.writeTo(System.out);
        } catch (Exception e) {
            e.printStackTrace();
            fail("Exception while writing the message to output");
        }
       
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.