The moose likes Other JSE/JEE APIs and the fly likes java mail through jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "java mail through jsp" Watch "java mail through jsp" New topic
Author

java mail through jsp

susham kumar
Greenhorn

Joined: Jul 20, 2011
Posts: 2

hi, i have used java mail for sending mail by making gmail as smtp server... its getting executed as and desktop application but when it comes to web application i couldn't execute it. problem is with the authentication class which is included in my application
class PasswordAuthenticator extends

javax.mail.Authenticator {
public PasswordAuthentication

getPasswordAuthentication() {
String user = "****************";
String pwd = "********";
return new PasswordAuthentication(user, pwd);
}
}

this class is called in the main program, of my mail application.. how to include both the classes in web.xml file when i use servlets and how to include both main class and the above class in JSP.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

You don't need to declare your authenticator class in web.xml. Neither do you need to import it in your JSP, if you are still writing antiquated JSP code which has embedded Java. All you need to do is make sure it gets deployed with your web application along with your other classes. It should go either in WEB-INF/classes or else in a jar in WEB-INF/lib.
 
 
subject: java mail through jsp
 
Threads others viewed
Prob in adding Java Bean in Apache Tomcat/4.0.3
Difference in behaviour of a class from executable jar and main method
problem in deploying java mail code in tomcat server
Java mail with authentication!
pop3 works, imap fails with No login methods supported!
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com