我正在使用SMTP从我的ReactJS应用程序发送ZIP文件。我可以将PNG图片作为附件发送,而无需将任何“ Content-Type”指定为SMTP属性。
但是当我添加了Content-Type : "application/octet-stream"
来发送zip文件时,它显示了[[位于“-”处的意外令牌。
这是我的SMTP连接代码;
sendEmail = (url, filename)=> {
Email.send({
Host: "smtp.gmail.com",
Content-Type : "application/octet-stream",
Username : "[email protected]",
Password : "xxxxxxxxxxxxxx",
To : '[email protected]',
From : "[email protected]",
Subject : "Your file is ready! ",
Body : "Body of the Email",
Attachments : [
{
name : filename,
path : url
}]
}).then(
message => alert("Mail Sent")
);
}
这就是它呈现的内容;Image of the output
Email.send({
Host: "smtp.gmail.com",
"Content-Type" : "application/octet-stream",
Username : "[email protected]",
Password : "xxxxxxxxxxxxxx",
To : '[email protected]',
From : "[email protected]",
Subject : "Your file is ready! ",
Body : "Body of the Email",