Package javax.mail

Examples of javax.mail.Transport.sendMessage()


                // Avoid a loop if we are stuck
                nAddresses = remainingAddresses.length;

                try {
                    // Send to the list of remaining addresses, ignoring the addresses attached to the message
                    transport.sendMessage(message, remainingAddresses);
                } catch(SendFailedException ex) {
                    bFailedToSome=true;
                    sendex.setNextException(ex);

                    // Extract the remaining potentially good addresses
View Full Code Here


            if (messageId != null) {
                // preserve explicitly specified message id, as it may be lost on save
                mimeMessage.setHeader("Message-ID", messageId);
            }
            LOG.debug("Sending MimMessage: {} using host: {}", mimeMessage, host);
            transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
        } finally {
            try {
                transport.close();
            } catch (MessagingException e) {
                LOG.warn("Error closing transport to host " + host + ". This exception will be ignored.", e);
View Full Code Here

        Transport transport = mailSession.getTransport("smtp");
        boolean jo = true;
        transport.connect(GMAILConfig.HOST, GMAILConfig.USER, GMAILConfig.PASS);

        try {
            transport.sendMessage(msg, msg.getAllRecipients());
            transport.close();
            return true;
        }
        catch (Exception err) {
            transport.close();
View Full Code Here

         }
         // Do the send manually, Transport.send gets the wrong transport
         getMimeMessage().saveChanges();
         Transport transport = getMailSession().getTransport();
         transport.connect();
         transport.sendMessage(getMimeMessage(), getMimeMessage().getAllRecipients());
         transport.close();
      }
      catch (MessagingException e)
      {
         throw new FacesException(e.getMessage(), e);
View Full Code Here

           
            // send the thing off
          Transport t = (Transport)session.getTransport("smtp");
          try {
            t.connect(mailhost, username, password);
          t.sendMessage(msg, msg.getAllRecipients());
          } catch (Exception e) {
            throw new RuntimeException( "Connection failure", e );
           } finally {
            t.close();
          }
View Full Code Here

    message.setSentDate(new Date());
    message.setContent(textMessage, contentType);
   
    Transport tr = smtpSession.getTransport("smtp");
    tr.connect(smtpHost, smtpUsername, smtpPassword);
    tr.sendMessage(message, message.getAllRecipients());
    tr.close();
  }

}
View Full Code Here

      message.setSubject(subject);
      message.setText(messageText);

      Transport transport = session.getTransport("smtp");
      transport.connect(properties.getProperty("mail.smtp.host", null), properties.getProperty("mail.smtp.user", null), properties.getProperty("mail.smtp.password", null));
      transport.sendMessage(message, message.getAllRecipients());
      transport.close();
    } catch (AddressException e) {
      throw new CoreException(new Status(IStatus.ERROR, UserAdminActivator.PI_USERADMIN, e.getMessage(), e));
    } catch (MessagingException e) {
      throw new CoreException(new Status(IStatus.ERROR, UserAdminActivator.PI_USERADMIN, e.getMessage(), e));
View Full Code Here

    //TEA 05/13/03, New method for sending so that we
    //can support SMTP authentication
    if (usingAuthentication) {
        Transport transport = session.getTransport("smtp");
        transport.connect (smtp_host, smtp_userId, smtp_password);
        transport.sendMessage(msg, msg.getAllRecipients());
        transport.close();           
    } else {
        Transport.send(msg);
    }           
  }
View Full Code Here

      // 设置发送方式smtp
      Transport t = s.getTransport("smtp");
      // 以smtp方式登陆邮箱 用到邮箱用户名和密码
      t.connect("smtp."+mailserver, uname, upwd);
      // 发送邮件
      t.sendMessage(m, m.getAllRecipients());
      // 关闭什么?
      t.close();

    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

        if (auth) {
            Transport transport = session.getTransport("smtp");
            transport.connect(host, port, username, password);
            msg.saveChanges();
            transport.sendMessage(msg, msg.getAllRecipients());
            transport.close();
        }
        else {
            Transport.send(msg);
        }
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.