The examples from the Mailgun documentation show how to send an attachment specified by a filename. Is it possible to send a dynamically generated string?
Something like the following:
var form = new FormData();
form.append("from", "me@me.com");
form.append("to", "you@you.com");
form.append("subject", "Email Subject");
form.append("text", "Email body");
form.append("attachment", "Attachment text content", "attachment.txt");
//POST form…
Using this code the attachment is ignored.
I was able to do this using a blob:
var file = new Blob(["Attachment text content"], {type: "text/plain"});
form.append("attachment", file, "attachment.txt");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.