Create Mime Message : Mime « Email « Java Tutorial

import java.util.Properties;

import javax.mail.Address;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class MainClass {

  public static void main(String[] args) throws Exception {

    Properties props = new Properties();
    props.put("", "");

    Session mailConnection = Session.getInstance(props, null);
    Message msg = new MimeMessage(mailConnection);

    Address a = new InternetAddress("", "A a");
    Address b = new InternetAddress("");

    msg.setContent("Mail contect", "text/plain");
    msg.setRecipient(Message.RecipientType.TO, b);

  Download: 2,318 k)

30.10.1.Create Mime Message
30.10.2.MIME types to use for various requests
30.10.3.Known mime types
30.10.4.MIME type mappings
30.10.5.A convenience class which handles conversions between MIME charset names and Java encoding names.
30.10.6.Frequently used MIME types