hi friends, i want to send mail by using jsp and servlet...can u please help me?? can u tell me code to do that?? wat will be server settings for that??
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
hi friends, i want to send mail by using jsp and servlet...can u please help me?? can u tell me code to do that?? wat will be server settings for that??
Please put this in the right forum...
Thanks.
The forum "Java Networking" will try to help you .
If you put it over there and make an effort in posting you will get help.
Also read this.
Im just trying to help
hi friends i want to send a mail by using java...
i have written below code but its not working...
String to = "onkar.gosavi@ahilane.com";
// Sender's email ID needs to be mentioned
String from = "thite.pradip57@gmail.com";
// Assuming you are sending email from localhost
String host = "localhost";
// Get system properties
Properties properties = System.getProperties();
// Setup mail server
properties.setProperty("mail.smtp.host", host);
// Get the default Session object.
Session session = Session.getDefaultInstance(properties);
try{
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
// Set Subject: header field
message.setSubject("This is the Subject Line!");
// Now set the actual message
message.setText("This is actual message");
// Send message
Transport.send(message);
System.out.println("Sent message successfully....");
}catch (MessagingException mex) {
mex.printStackTrace();
}
can u tell what will value of host???
Duplicate threads merged.