Package javax.mail.internet

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


                    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


            }
          }
        }
      } else {
        log.info("Did not know what to do with it. Here is the Body : ");
        message.writeTo(System.out);
        forward(message, "calendar@avicenaweb.appspotmail.com", "avicena@casamind.com");
      }

    } catch (MessagingException e) {
      // TODO Auto-generated catch block
View Full Code Here

        multipart.addBodyPart(mimePart);
        message.setContent(multipart);
        message.setHeader("Content-Type", multipart.getContentType());
        message.saveChanges();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        message.writeTo(baos);
        log.info(baos.toString());
       
        SoapMarshaler marshaler = new SoapMarshaler(true);
        SoapMessage msg = marshaler.createReader().read(new ByteArrayInputStream(baos.toByteArray()), multipart.getContentType());
        assertTrue(msg.getSource().equals(SoapReader.EMPTY_CONTENT));
View Full Code Here

            assertEquals("this is a unittest", sentMessage.getSubject());
           
            assertEquals("this is the content of the message", sentMessage.getContent());
           
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            sentMessage.writeTo(output);
            String payload = new String(output.toByteArray());
           
            System.out.println("Mail message payload:\n\n" + payload + "\n");
        }
    }
View Full Code Here

                    printWriter.println(MailSrvConstants.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(MailSrvConstants.ERR);
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

                    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) {
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 = null;
View Full Code Here

                        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

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.