|
Java™ by example!
|
|
|
How do I create a email containing attachments using JavaMail?
This simple example creates an .eml file (which you can open with eg. Outlook Express) containing the file c:\autoexec.bat as an attachment. Creating an attachment with JavaMail is simple: pass a DataSource instance to the constructor of DataHandler and add it to a MimeBodyPart. Add all the MimeBodyParts to a Multipart instance and initialize the message with it. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|