aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Sending attachments with emails in Javamail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Sending attachments with emails in Javamail" Watch "Sending attachments with emails in Javamail" New topic
Author

Sending attachments with emails in Javamail

Ajay Saxena
Ranch Hand

Joined: Nov 13, 2006
Posts: 154
I'm trying to send attachments with emails using Javamail. Following is the code through which I'm trying to achieve that. It works as expected on a JRE1.6 environment. But on JRE1.5, the content of the file gets added to the mail body as text

Any pointers on the observed difference in behavior would be highly appreciated!





The email in case of JRE1.5 is as follows

------=_Part_0_33189144.1233078680250
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi...Test Mail
------=_Part_0_33189144.1233078680250
Content-Type: application/octet-stream; name=corba_architecture.pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=corba_architecture.pdf
Content-ID: Attachment

JVBERi0xLjIgDSXi48/TDQogDTggMCBvYmoNPDwNL0xlbmd0aCA5IDAgUg0vRmlsdGVyIC9GbGF0
ZURlY29kZSANPj4Nc3RyZWFtDQpIiUWPW07DMBBFV+A93E9QlWBP/Kj5awt8USFRbyBKnTQIkshK
YfvYcQoaybrSzDkzFhCxQgemeWkUyKTXEIeSHMGjZXvHSFBJCpXUpQLcE+NIlbCHFw4pUxeuZQUv
ueY25gYxk9mKmH9wtwvNpZ99M1+jc2wxXzxweHvf73AP9xGFhaIsTyC3/w6ZDYfxaxoHP8w4jmf/

......

------=_Part_0_33189144.1233078680250--
 
wood burning stoves
 
subject: Sending attachments with emails in Javamail