问题
* SOLVED * solution to below problem was to add"--" in the end of the last boundary delimiter ----boundary_text_string**--**
I use below code to create MIME eml mail client side in javascript.
If I leave a "blank" line between Content-Type: text/html; charset="utf-8"
and <html>
then beside the attachment I add and want, there is another, unwanted one "Untitled attachment 01376.txt",
that gets automatically added by magic to the mail.
All other parts of the mail with subject and body text etc are as wanted.
See pic "with line.jpg".
As I can see in PSPad this strange file only contains hex "FFFE".
If I remove the line between Content-Type: text/html; charset="utf-8"
and <html>
then there is only the attachment that I want (no other one) but suddenly no body text.
See pic "without line.jpg".
Code:
<textarea id="textbox_mailing" style="width: 600px; height: 600px; display:none;">
To: %%RECIPIENT%%
Subject: %%BETREFF%%
X-Unsent: 1
Content-Type: multipart/mixed; boundary=--boundary_text_string
----boundary_text_string
Content-Type: text/html; charset="utf-8"
<html>
<head>
<style>
body, html, table
{
font-family: Calibri
}
table
{
border: 1px solid silver;
padding: 2px;
}
thead, th
{
text-align: left;
border-bottom: 0.5px solid silver;
}
tbody td {
text-align: left;
}
</style>
</head>
<body>
%%ANREDE%%,<br>
<br>
lore ipsum lore ipsum....<br>
<br>
%%ANGEBOTE_PENDING%%
<br>
%%SIGNATUR%%
</body>
</html>
----boundary_text_string
Content-Type: application/pdf; name=example.pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment
%%B64_STREAM%%
----boundary_text_string
</textarea>
This problem makes my life miserable for more than a week now, any help very much appreciated!
Thx a lot, BR Michael.
PS: please no general discussion why not serverside or why not using mail platforms.
Code with blank line
Code without blank line
来源:https://stackoverflow.com/questions/59870334/solved-javascript-created-eml-with-attachment-contains-one-more-unwanted-attachm