Java Email Send sendMail(Session session, Message message)

Here you can find the source of sendMail(Session session, Message message)

Description

send Mail

License

Apache License

Declaration

public static void sendMail(Session session, Message message) throws MessagingException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;

public class Main {
    public static String user;
    private static String password;

    public static void sendMail(Session session, Message message) throws MessagingException {
        Transport transport = session.getTransport();
        transport.connect(user, password);
        transport.sendMessage(message, message.getAllRecipients());
    }/*from   w ww. ja v a 2  s  .  c  o m*/
}

Related

  1. sendEmail(Session session, String fromEmail, String toEmail, String subject, String body)
  2. sendEmail(String subject, String text, String receiverEmail)
  3. sendEmail(String to, String from, String subject, String text)
  4. sendEmail(String toAddress, String subject, String message)
  5. sendMail(Properties props, String recipients[], String subject, String message, String from)
  6. sendMail(String filePathName, InternetAddress[] addresses, List> md5cellRows, String today, byte[] report1bytes, byte[] report2bytes, byte[] report3bytes)
  7. sendMail(String host, int port, String username, String password, String recipients, String subject, String content, String from)
  8. sendMail(String smtpServer, String to, String from, String subject, String body)
  9. sendMail(String to, String from, String subject, String body, boolean bodyIsHTML)