Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send email with no attachment?

Alvin de Jesus
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MimeBodyPart textPart = new MimeBodyPart();

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));

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic