I am using sendmail library of unix to send mail. I am sending a mail with an attachment which is a (Microsoft word) .docx file. This word file has images in it. The issue is, receiver is not able to open a mail attachment which is word (.docx file) with images inside it. Opening a Microsoft word file gives error "file is corrupted".
Receiver is able to open a word file if it has only text in it. Problem comes only when the word file has images in it, and that word file is being send as a attachment of a mail.
Here is the file content looks like. This is a sh file, and use sendmail api of linux to execute this sh file for sending mail..
echo -e MIME-Version: 1.0;
echo -e 'Content-Type: multipart/mixed; boundary="CONTENT_BOUNDARY"';
echo ;
echo -e --CONTENT_BOUNDARY;
echo -e 'Content-Type: text/html; charset=utf-8';
echo ;
echo -e " ";
echo ;
echo -e --CONTENT_BOUNDARY;
echo -e 'Content-Type: text/plain; charset=utf-8';
echo ;
echo -e "Hello World!";
echo ;
echo -e --CONTENT_BOUNDARY;
echo -e 'Content-Type: text/html; charset=utf-8';
echo ;
echo -e "<b>Hello</b> <i>World</i>!";
echo ;
echo -e --CONTENT_BOUNDARY;
echo -e 'Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document; name=Editor-issue-6-30-2016.docx';
echo -e 'Content-Transfer-Encoding: base64';
echo ;
echo -e PK
When the attached word file is opened in the microsoft word, this is how it image looks like (not same as the original image)
When I try to send the same attachment using other mail sending api like nodemailer in node.js, this attachment get properly opened by the receiver.
Any help highly appreciated.
Thanks.