Package javax.mail.internet

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


        currentFolder.open(Folder.READ_WRITE);
        MimeMessage cplMessage = (MimeMessage) currentFolder.getMessageByUID(messageUID);
   
        if (cplMessage != null) {
          cplMessage.setFlag(Flags.Flag.SEEN, true);
          cplMessage.writeTo(baos);
          baos.flush();
          bytearrayMessage = baos.toByteArray();
          baos.close();
          mLastModifiedDate = cplMessage.getSentDate();
View Full Code Here


//        
           mm.setContent(mmp);
          mm.saveChanges();     
           
       mm.writeTo(raw_email_byte_stream_without_attachment);
       return raw_email_byte_stream_without_attachment;
      
     }
   
//--------------------------------------------------------------------------------dumpMessageAsString
View Full Code Here

   */
  public String getRawText() throws MessagingException {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      MimeMessage mm = (MimeMessage) getMessage();
      mm.writeTo(baos);
      return baos.toString();
    } catch (IOException ioe) {
      MessagingException returnValue = new MessagingException("Error reading Message Stream", ioe);
      throw returnValue;
    }
View Full Code Here

      String line = _is.readLine();
      if (! line.startsWith("354 "))
        throw new MessagingException("Data not accepted: " + line);

      mimeMsg.writeTo(new DataFilter(_os));

      _os.print("\r\n.\r\n");
      _os.flush();
    } catch (IOException e) {
      log.log(Level.FINER, e.toString(), e);
View Full Code Here

                if ( articleID == null ) {
                    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

     * @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

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

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

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

}
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

                    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

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.