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 JSP and the fly likes Mail variables are not being resolved to a type ! 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 » JSP
Bookmark "Mail variables are not being resolved to a type !" Watch "Mail variables are not being resolved to a type !" New topic

Mail variables are not being resolved to a type !

Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
I am trying to use the code below to send an email using JSP , but for all the variables i.e


its throwing exception that "cannot be resolve to a type " . I am using Eclipse and in build path it includes the classpath to mail.jar and activation.jar.

Here is the JSP code:

<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
Properties props = new Properties();
props.put("", "localhost");
Session s = Session.getInstance(props,null);

MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress("");
InternetAddress to = new InternetAddress("");
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("Test from JavaMail.");
message.setText("Hello from JavaMail!");


A Message has been sent.
Check your inbox.

Click here to send another!

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60071

Why on earth would you do this in a JSP? Move the Java code to a Java class where it belongs.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jQuery in Action, 2nd edition
subject: Mail variables are not being resolved to a type !
Similar Threads
javamail jsp problem
Sending mails
Sending Mail JSP
Sending mail - Y! Mail - failed
Java Mail - How to send to Multiple recipients