Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Alvin de Jesus

Greenhorn
+ Follow
since May 05, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alvin de Jesus

Hi
I'm currently developing a email servlet that can also do a file attachment. I got my email servlet to work properly from the client-side, but when I uploaded my servlet to the server, the file attachment does not work. In other words, when the servlet is running from the server, and a client/end-user wants to attach a file. The email msg sends fine without the file attachement.

21 years ago
MimeBodyPart textPart = new MimeBodyPart();
textPart.setText(text);

I've written a email servlet using Java Mail that allows file attachment.
The problem that I'm having is that every time I send an email without a attach file. The email does not sends out.
Please advise! Alvin
Here's my code looks like:
======================================
Multipart mp = new MimeMultipart();

MimeBodyPart attachFilePart = new MimeBodyPart();

FileDataSource fds = new FileDataSource(attachment);
attachFilePart.setDataHandler(new DataHandler(fds));
attachFilePart.setFileName(fds.getName());

mp.addBodyPart(textPart);
mp.addBodyPart(attachFilePart);
message.setContent(mp);
21 years ago
This can be done by doing:
message.setRecipients(Message.RecipientType.CC, CC);
message.setRecipients(Message.RecipientType.BCC, BCC);
I hope this helps!
21 years ago