FileDocCategorySizeDatePackage
Assimilator.javaAPI DocExample870Mon Oct 09 13:09:16 BST 2000None

Assimilator.java

import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;

public class Assimilator {

  public static void main(String[] args) {

    Properties props = new Properties();
    props.put("mail.host", "mail.cloud9.net");

    try {
       
      Session mailConnection = Session.getInstance(props, null);
      
      Address bill = new InternetAddress("god@microsoft.com", "Bill Gates");
      Address elliotte = new InternetAddress("elharo@metalab.unc.edu");

      Message msg = new MimeMessage(mailConnection);
    
      msg.setFrom(bill);
      msg.setRecipient(Message.RecipientType.TO, elliotte);
      msg.setSubject("You must comply.");
      msg.setContent("Resistance is futile. You will be assimilated!", 
       "text/plain");
      
      Transport.send(msg);
      
    }
    catch (Exception e) {
      e.printStackTrace(); 
    }
    
  }

}