Package javax.mail

Examples of javax.mail.Message.saveChanges()


        // to write other message headers automatically.
        Message msg = new MimeMessage(session);
        // Set message attrubutes as in a singlepart
        // message.
        msg.setContent(mp); // add Multipart
        msg.saveChanges(); // save changes
    }
}
View Full Code Here


//              //把mtp作为消息对象的内容
//              msg.setContent(mtp);
           /**********************发送附件结束************************/ 

            //先进行存储邮件
            msg.saveChanges();
            Transport trans=mailConnection.getTransport(props.getProperty("mail.protocal"));
            //邮件服务器名,用户名,密码
            trans.connect(props.getProperty("mail.smtp.host"), props.getProperty("mail.user"),  props.getProperty("mail.pass"));
            trans.sendMessage(msg, msg.getAllRecipients());
           
View Full Code Here

  public void sendMail(Mail email, MailTransport transport)
      throws MailException {
    if (MailUtils.validate(email)) {
      try {
        Message message = prepareMessage(email);
        message.saveChanges();

        Transport t = session.getTransport(transport.getProtocol());
        t.connect();
        t.sendMessage(message, message.getAllRecipients());
        t.close();
View Full Code Here

            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress(FROM));
            msg.addRecipient(Message.RecipientType.TO, new InternetAddress(TO));
            msg.setSubject(SUBJECT);
            msg.setText(BODY);
            msg.saveChanges();

            // Reuse one Transport object for sending all your messages
            // for better performance
            Transport t = new AWSJavaMailTransport(session, null);
            t.connect();
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.