我正在使用nodemailer发送带有pdf附件的电子邮件,电子邮件已成功发送,但是通过电子邮件下载时pdf附件损坏。以下是我的mailOptions:
let mailOptions = {
from: 'writingtest@email.xxx.com', // sender address mailfrom must be same with the user
to: receiveEmail, // list of receivers,use , to split
cc:'service@xxx.com', // copy for receivers
subject: 'writing test from xxx.com', // Subject line
text: 'Hello world', // plaintext body
replyTo: 'service@xxx.com', //send reply email address
attachments: [
{
filename: 'test.pdf',
filePath: '../../files/test.pdf',
contentType: 'application/pdf',
}
],
};
从回调收到的信息是:
message sent: 250 Data Ok: queued as freedom ###envid=19950767140