0
votes

Our service send email with attachment which is not visible on ios devices.

AWS team suggested to add double quotes around file name but when i try to add ", MimeBodyPart turning into escape character.

MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setDisposition(Part.ATTACHMENT);
messageBodyPart.setDataHandler(new DataHandler(Base64.getMimeDecoder()
.decode(attachment.getAttachment()), attachment.getContentType()));
messageBodyPart.setFileName("\""+ attachment.getName()+"\"");

From: [email protected] To: [email protected] Message-ID: <962944318.2.1571250351443@[10.200.78.179]> Subject: subject for test MIME-Version: 1.0 Content-Type: multipart/related;
boundary="----=_Part_1_977674685.1571250351337"

------=_Part_1_977674685.1571250351337 Content-Type: multipart/alternative;
boundary="----=_Part_0_474488818.1571250351334"

------=_Part_0_474488818.1571250351334 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi your email send is success ------=_Part_0_474488818.1571250351334--

------=_Part_1_977674685.1571250351337 Content-Type: application/pdf; name="\"myData.pdf\"" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="\"myData.pdf\""

ICAgICAgICAgDXhyZWYNNCAxMQ0wMDAwMDAwMDE2IDAwMDAwIG4NCjAwMDAwMDA2NjAgMDAwMDAg ------=_Part_1_977674685.1571250351337--

1
Does mail client on ios atleast show there is an attachment and couldn't open the attachment ? or you don't see attachment at all in received email ?James Dean
It shows that there's an attachment but when i open the email i dont see one. I can open the attachment in the iCloud web interface it just IOS mail app that is having the issue.The Rock

1 Answers

0
votes

Found fix, issue was with respect to content-type. changing content-type to multipart/mixed resolved it.