This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes JSP Email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JSP Email" Watch "JSP Email" New topic
Author

JSP Email

Virendra Chandak
Greenhorn

Joined: Jun 25, 2010
Posts: 4
Hi,

I am using the following code to send email using JSP through gmail.

But i am getting error in the following line:
Session mailSession = Session.getDefaultInstance(props, null);





Does anyone else is also getting similar error?

Or do you have any better way to send email using jsp.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

This is an a JSP? Very inappropriate. Move the code to a Java class.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Does anyone else is also getting similar error?

Hard to say, since you didn't tell us the actual error you got.


Ping & DNS - updated with new look and Ping home screen widget
Virendra Chandak
Greenhorn

Joined: Jun 25, 2010
Posts: 4
Sorry, about that

In the line
Session mailSession = Session.getDefaultInstance(props, null);

I am getting the following error:

Session cannot be resolved to a type
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
How are you importing that class?

But as Bear said, it's terrible design to do this kind of thing in a JSP.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Email
 
Similar Threads
Need Help with JavaMail program
JSP using javamail
E mail using JSP Error
creating website basic question
JavaMail Session cannot be resolved to a type