on 11-07-2006 8:47 AM
Hi all,
I want to send an email. I have this code.
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
Properties p = new Properties();
p.put("mail.transport.protocol", "smtp");
p.put("mail.smtp.host", "server name");
p.put("mail.smtp.port", "25");
String subject = sub.getValue().toString();
TextEdit body =
(TextEdit) this.getPageContext().getComponentForId(
"Message");
String bodystr = body.getText();
MimeMessage m = new MimeMessage(s);
InternetAddress myAddress =
new InternetAddress(user.getEmail());
recipientAddress = new InternetAddress(email);
m.setFrom(myAddress);
m.setRecipient(Message.RecipientType.TO, recipientAddress);
m.setSubject(subject);
m.setContent(bodystr, "text/plain");
Transport.send(m);
I cant import those libraries. It seems they are missing. (import is underlined and says: The import cant be resolved) What should I do? Where can I get those libraries?
PLS help.
Ivo
Hi Ivo Kostelecky,
You just need to add the mail.jar and activation.jar to ur project to resolve the issue.
Select your project -> Right Click -> Properties -> Java Build Path -> Add Exeternal Jars
Select the above mentioned jar files and then add it.
These two jar files can be downloaded from
<a href="http://java.sun.com/products/javamail/downloads/index.html">http://java.sun.com/products/javamail/downloads/index.html</a>
If you cannot find them then I will forward it to you.
Regards
Jhansi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.