This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


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: 61315
    
  66

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: 42047
    
  64
Does anyone else is also getting similar error?

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


Ping & DNS - my free Android networking tools app
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: 42047
    
  64
How are you importing that class?

But as Bear said, it's terrible design to do this kind of thing in a JSP.
 
GeeCON Prague 2014
 
subject: JSP Email