• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need blank line between each mail body part

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have been trying different method to insert new blank line between the mail boundary and bodypart without a positive result. Please help me

. Here is the output
1. There must be a space between the xml (base64 encoded) and the attachment boundary.

Example –

Original:
aWNlLnBkZi5wZGY8L0F0dGFjaG1lbnRGaWxlbmFtZT4NCjxBdH RhY2htZW50U3RhdHVzQ2Q+Y3Np
bzo1PC9BdHRhY2htZW50U3RhdHVzQ2Q+DQo8L0ZpbGVBdHRhY2 htZW50SW5mbz4NCjxjc2lvOlJl
bWFya3NJbmZvPjxSZW1hcmtUZXh0PnRoaXMgaXMgYSB0ZXN0PC 9SZW1hcmtUZXh0PjwvY3NpbzpS
ZW1hcmtzSW5mbz48L0FjdGl2aXR5Tm90ZVJzPg0KPC9Db21tb2 5TdmNScz4NCg==
------=_Part_7_1101808044.1378474555659
Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=test.pdf
Content-ID: test.pdf

Edited:

aWNlLnBkZi5wZGY8L0F0dGFjaG1lbnRGaWxlbmFtZT4NCjxBdH RhY2htZW50U3RhdHVzQ2Q+Y3Np
bzo1PC9BdHRhY2htZW50U3RhdHVzQ2Q+DQo8L0ZpbGVBdHRhY2 htZW50SW5mbz4NCjxjc2lvOlJl
bWFya3NJbmZvPjxSZW1hcmtUZXh0PnRoaXMgaXMgYSB0ZXN0PC 9SZW1hcmtUZXh0PjwvY3NpbzpS
ZW1hcmtzSW5mbz48L0FjdGl2aXR5Tm90ZVJzPg0KPC9Db21tb2 5TdmNScz4NCg==

------=_Part_7_1101808044.1378474555659
Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=test.pdf
Content-ID: test.pdf


My code is as follow:
Multipart multipart = new MimeMultipart("related");
FileDataSource fds = new FileDataSource(savePath+"edocs_transaction_request .xml");
BodyPart part2 = new MimeBodyPart();
part2.setText(System.getProperty("line.separator") );
part2.setDataHandler(new DataHandler(fds));
part2.setFileName(fds.getName());
part2.setHeader("Content-Transfer-Encoding","base64");
part2.setHeader("Content-Type", "text/xml; charset=\"UTF-8\"");
part2.setHeader("Content-ID","ACORD");
multipart.addBodyPart(part2);
BodyPart part3 = new MimeBodyPart();
part3.setText(System.getProperty("line.separator") + System.getProperty("line.separator"));
fds = new FileDataSource(savePath+fileName.substring(fileNam eIndex+1));
part3.setDataHandler(new DataHandler(fds));
part3.setFileName(fds.getName().toLowerCase());
part3.setHeader("Content-Type", "application/pdf");
part3.setHeader("Content-ID", fds.getName().toLowerCase());
multipart.addBodyPart(part3);
msg.setContent(multipart);
msg.saveChanges();
javax.mail.Transport.send(msg);


I hope Someone can help me..

Many thanks
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand, why do you want the blank line?
 
marc nguyen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not me but the client is requesting for it. That is why it made my life a nightmare.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic