Saturday, 13 May 2017

How to retrieve every part of an email except from attachments

I'm currently using node-imap in order to try to retrieve emails from a central server. Unfortunately, I'm struggling to retrieve emails from the server without any attachments but still retrieving the HTML & text body components. At the moment I'm using:

{
  bodies: '', 
  struct: true, 
  envelope: true
}

In order to specify the parts I need. This gets every part of the email, however and some of them have attachments >50mb. I've tried to limit it to just the body using the 'TEXT' component:

{
  bodies: 'TEXT', 
  struct: true, 
  envelope: true
}

But that appears to not retrieve the HTML body of the email. Is there a way to retrieve everything except the attachment from an email?



via Popey Gilbert

No comments:

Post a Comment