2015-10-23 50 views
0

尝试注意。在nodemailer采用DPD-电子邮件(其使用nodemailer) 通过实例文件(https://github.com/andris9/Nodemailer#attachmentsdpd-email/nodemailer不需要修改文件

这只是给我的“依恋1.bin”文件大小0KB

使用来自不同势后例子尝试nodemailer站点,但结果相同。

使用铬邮递员

 http://localhost:99/email 
     to:"[email protected]" 
     subject: "test" 
     text: "test" 
     attachments: [ 
    {filename: "test.tx"', content:"hello world", contentType:"text/plain"} 

] 

enter image description here

回答

0

在NodeMailer,attachmentsattachment对象的数组。在上面的代码片段中,您将attachments设置为对象而不是数组。

直接从E-mail Message Fields

附件摘自 - 附接的对象数组

变化

attachments: { 
    filename: 'text.bin', 
    content: 'hello world!', 
    contentType: 'text/plain' 
} 

attachments: [ 
    { 
    filename: 'text.bin', 
    content: 'hello world!', 
    contentType: 'text/plain' 
    } 
] 
+0

附件:[{文件名: “test.tx””,内容: “世界你好”,则contentType: “text/plain的”}] –

+0

依然只是让我依恋1.bin –