Thursday 7 May 2015

SMTP PROGRAM IN JAVA

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

public class Assimilator
{
public static void main(String args[])
{
try
{
Properties props=new Properties();                                                                          
props.put(“mail.host”,”mail.cloud9.net”);
session mailConnection=session.getInstance(props,null);
Message msg=new MimeMessage(mailConnection);
      Address bill=new InternetAddress(“yo@microsft.com,”Billgates”);
Address elliotte=new InternetAddress(“elhax@matlab.edu”);
      msg.setContent(“smtp.demo”,”text/plain”);
msg.setFrom(bill);
msg.setRecipient(Message.RecipientType.To,elliotte);
msg.setSubject(“SMTP”);
Transport.send(msg);
}
catch(Exception e)
{
}
}

}


No comments:

Post a Comment