Email application.

Hi..

My jsp application mainly focus on generating several reports from data stored in database... So there should be provision for sending the reports generated by my application thru email for others...

Can anybody help me in attaining this?... glad if u provide the sample code too..

[306 byte] By [eldho_frsa] at [2007-11-26 22:53:59]
# 1
Check the javax.mail API.
BalusCa at 2007-7-10 12:17:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
i have a simple, effective jsp applcaiton that sends email effeciently, i can provide u the code , but first i need the 10$ duke
Eng.Mohammeda at 2007-7-10 12:17:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
> i can provide u the code , but first i need the 10$ dukewtf?
BalusCa at 2007-7-10 12:17:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
> wtf?what is this ?
Eng.Mohammeda at 2007-7-10 12:17:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

This is an slang abbrevation for "What the ****?".

It isn't that hard. Just read the javax.mail API and then code accordingly.

Basic example:

// Get session.

Properties properties = new Properties();

properties.put("mail.smtp.host", "smtp.example.com");

Session session = Session.getDefaultInstance(properties, null);

try {

// Prepare message.

Message message = new MimeMessage(session);

message.setFrom(new InternetAddress("from@example.com"));

message.setRecipient(Message.RecipientType.TO, new InternetAddress("recipient@example.com"));

message.setSubject("subject");

message.setContent("message", "text/plain");

// Send message.

Transport.send(message);

} catch (MessagingException e) {

// Do your thing.

}

BalusCa at 2007-7-10 12:17:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...