JAVA MAIL using JSP
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Utkarsh_Shah
Posted On:   Saturday, October 30, 2004 09:48 AM

i would like to develop a mail facility for my project
so how can i use javax.mail to send , read & delete mail from my web page using JSP

Re: JAVA MAIL using JSP

Posted By:   thirumalai_samy  
Posted On:   Wednesday, January 26, 2005 09:48 PM

javax.mail package is not available hot to get it.

Re: JAVA MAIL using JSP

Posted By:   thirumalai_samy  
Posted On:   Wednesday, January 26, 2005 09:46 PM

i too having the same problem. how can i import javax.mail to my coding..

Re: JAVA MAIL using JSP

Posted By:   Anonymous  
Posted On:   Monday, November 29, 2004 02:47 AM


This is the sample code you can use to send mail



JSP JavaMail Example




<%@ page import ="java.util.*" %>
<%@ page import ="javax.mail.*" %>
<%@ page import ="javax.mail.internet.*" %>
<%@ page import ="javax.activation.*" %>
<%
String host = "mail.genesseetech.com";
String to = "anil1@genesseetech.com";
String from = "venkatesh@genesseetech.com";
String subject = " Mail from JSP Program-- Venkatesh";
String messageText = " Hello this is test mail from JSP--Venkatesh";
boolean sessionDebug = false;

// create some properties and get the default Session

Properties props = System.getProperties();
// for getting acknowledgements
props.put("mail.smtp.dsn.notify","SUCCESS,FAILURE ORCPT=rfc822;anil1@genesseetech.com");
props.put("mail.smtp.dsn.ret", "HDRS");



// End of getting Acknowledgements

props.put("mail.host",host);
props.put ("mail.transport.protocol","smtp");

Session mailSession = Session.getDefaultInstance(props,null);

// Set debug on the Session so we can see what is going on
// Passing false will not techo debug info, and passing truee will

mailSession.setDebug(sessionDebug);

// Instantiate a new Mime message and fill it with the required Information
int res;
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO,address);
//res = Message.RecipientType(RETURN_FULL);
msg.setSubject(subject);
msg.setSentDate (new Date());
msg.setText(messageText);


// Hand the message to the default transport service for delivary
Transport.send(msg);
out.println("From " + from );
out.println("
");
out.println("Mail sent to " + to);
out.println("
");
// out.println(res);
out.println("Using host " + host + ".");

%>



Re: JAVA MAIL using JSP

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, October 31, 2004 07:32 AM

You might find it better to read and delete mail from a mailbox, not from a web page.
About | Sitemap | Contact