Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Email

 
Virendra Chandak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an a JSP? Very inappropriate. Move the code to a Java class.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone else is also getting similar error?

Hard to say, since you didn't tell us the actual error you got.
 
Virendra Chandak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you importing that class?

But as Bear said, it's terrible design to do this kind of thing in a JSP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic