/*
 * Created on 14-Dec-2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author mar
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import javax.mail.*;
import javax.mail.internet.*;

public class MailTest {

    public static void main(String[] args) {
        try {
        java.util.Properties properties = System.getProperties();
        Session session = Session.getInstance(properties, null);
        // Construct a message
        MimeMessage message = new MimeMessage(session);
        message.setFrom(new InternetAddress("mar@roe.ac.uk"));
        message.addRecipient(Message.RecipientType.TO, new InternetAddress("kandmread@btinternet.com"));
              message.addRecipient(Message.RecipientType.BCC, new InternetAddress("mar@roe.ac.uk"));
        message.setSubject("WFCAM Science Archive");
        message.setText("The results of your query can be retrieved from \n" );
        
        Transport transport = session.getTransport("smtp");
        transport.connect("mail.roe.ac.uk", "", "");

        // Send the message and close the connection
        transport.sendMessage(message, message.getAllRecipients());
        transport.close();
        
    } catch (MessagingException me) {
       System.out.println(me.getMessage());
    }
    }
}
