• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending attachments with emails in Javamail

 
Ajay Saxena
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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--
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic