/* * To change this template, choose Tools | Templates * and open the template in the editor. */
package javaapplication2; import java.text.*; import java.util.*; import javax.mail.*; import javax.activation.*; import javax.mail.internet.*; class test { public static void main(String[] args){ try{ InternetAddress to = new InternetAddress("kumar.anuj...@gmail.com" , "Recipient"); InternetAddress from = new InternetAddress("kumar.anuj...@gmail.com" , "Sender"); Properties prop = new Properties(); prop.put("mail.smtp.host", "nitdgp.ac.in"); Session mailSession = Session.getDefaultInstance(prop, null); Message msg = new MimeMessage(mailSession); msg.addRecipient(Message.RecipientType.TO, to); msg.setSubject("test"); msg.setFrom(from); msg.setText("sjdggsd"); Transport.send(msg); } catch(Exception e){e.printStackTrace();} } } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- when i run this file i get javax.mail.MessagingException: Unknown SMTP host: nitdgp.ac.in; Please help me. Thanks&Regards Anuj Kumar -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en