0

Trying to att. a file using dpd-email (its using nodemailer) by examples in nodemailer (https://github.com/andris9/Nodemailer#attachments)

This just gives me a file of 'attachment-1.bin' 0kb of size

tried using diffrent post examples from the nodemailer site, but same result.

Using chrome postman

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

]

enter image description here

Thomas
  • 123
  • 1
  • 1
  • 12

1 Answers1

0

In NodeMailer, attachments is an array of attachment objects. In your above code snippet though, you're setting attachments to an object instead of an array.

Taken directly from E-mail Message Fields

attachments - An array of attachment objects

Change

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

To

attachments: [
  {
    filename: 'text.bin', 
    content: 'hello world!', 
    contentType: 'text/plain' 
  }
]
peteb
  • 18,552
  • 9
  • 50
  • 62