0
你好我使用節點郵件發送郵件。它工作正常進行attachment.But每當我給一些附件需要默認的內容「數據」作爲它的內容。我應該怎樣避免這種..附件在節點郵件程序中無法正常工作?
我節點的郵件功能是看起來像這樣...
function sendMail(toMailId, subject, body) {
for (var i = 0; i < 1; i++) {
email.send({
ssl: true,
host: DbConfig.mailConfig.host,
port: DbConfig.mailConfig.port,
domain: DbConfig.mailConfig.domain,
to: DbConfig.mailConfig.to,
from: DbConfig.mailConfig.from,
subject: subject,
reply_to: DbConfig.mailConfig.reply_to,
body: body,
authentication: DbConfig.mailConfig.authentication,
username: DbConfig.mailConfig.username,
password: DbConfig.mailConfig.password,
attachments: [
{
filename: "helloworld.txt",
content : 'data'
}
],
debug: DbConfig.mailConfig.debug
},
function (err, result) {
if (err) { console.log(err); }
});
}
}
我的問題是,當我收到的郵件在我的收件箱後,打開附件,它只是顯示主體數據。除此之外它什麼都不顯示。當我刪除內容意味着它會拋出錯誤..
的json看起來就像這樣:
{
"mongodbUrl":"mongodb://USERID:[email protected]:27017/DBNAME",
"mailConfig" :{
"to":"[email protected]",
"host": "smtp.gmail.com",
"port": 465,
"domain": "[127.0.0.1]",
"from":"[email protected]" ,
"subject":"This is my mail subject,
"reply_to": "[email protected]",
"authentication": "login",
"username": "[email protected]",
"password": "pswd",
"debug": true
}
}
當我發送PDF文件意味着它是不開放。當發送文本文件,意味着它與開'內容數據'..怎麼處理這個?