question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting the mail body as plain text (without headers)

See original GitHub issue

Hi!

I don’t manage to get only the body of an email! I am doing like this http://pastebin.com/eYs5w7M8

and when looking at what I got in body, I have also the headers :

------Nodemailer-0.4.4-?=_1-1379435408278<CR><LF>
Content-Type: text/plain; charset=utf-8<CR><LF>
Content-Transfer-Encoding: quoted-printable<CR><LF>
<CR><LF>
I am testing
...

So is there a way to get only the “I am testing” bit?

Thanks!!!

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mscdexcommented, Sep 17, 2013

For multipart messages, instead of ‘TEXT’, prepend the part number (you can get this from partID if you fetched the structure). So to fetch the first part use ‘1.TEXT’.

1reaction
mscdexcommented, Jan 19, 2014

You stated ‘I’m sorry, I meant just ‘1’, not ‘1.TEXT’.’, but I don’t understand where that should be?

var imapFetch = imap.fetch(results, { 
  bodies: [ 'HEADER.FIELDS (FROM TO SUBJECT)', '1'], 
  struct: true 
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to print email body only without header and username in ...
1. Select the email you will print without header, and click Home > Reply. · 2. Now the Reply Message window is opening....
Read more >
Change the message format to HTML, Rich Text Format, or ...
On the File tab, choose Options > Mail. Under Compose messages, in the Compose messages in this format list, click HTML, Plain Text,...
Read more >
Python: Retrieving only POP3 message text, no headers
This keys off the first empty line in the list of all lines as the end of the header info. Then just list...
Read more >
Emails come through with headers only, no body even though ...
Emails come through with headers only, no body even though the body exists on the server. Other times, the message comes through as...
Read more >
Learn Why Plain Text Emails Still Work and How to Use Them
Included is a plain text email template to get you started. ... with content from the HTML part of the message, without spending...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found