Is this a valid SMTP server? Does your firewall/smtp server accept requests from your machine (ip range, etc) ?
Alessandro Dias ========================== http://lattes.cnpq.br/2174571414137869 Mail: alessandro.valerio.d...@gmail.com Marie von Ebner-Eschenbach - "Even a stopped clock is right twice a day." - http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html On Mon, Dec 7, 2009 at 13:19, ANUJ KUMAR <kumar.anuj...@gmail.com> wrote: > /* > * 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 -- 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