# Retrieving email message body only via 'net/pop'

**URL:** <https://www.ruby-forum.com/t/retrieving-email-message-body-only-via-net-pop/88124>\
**Category:** Ruby\
**Created:** [March 8, 2007, 11:35am UTC](https://www.ruby-forum.com/t/retrieving-email-message-body-only-via-net-pop/88124 "2007-03-08T11:35:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dazzle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@dazzle](https://www.ruby-forum.com/u/dazzle)\
**Post date:** [March 8, 2007, 11:35am UTC](https://www.ruby-forum.com/t/retrieving-email-message-body-only-via-net-pop/88124/1 "2007-03-08T11:35:29Z")

</div>

Hi,

Is it possible to retrieive just the email message body using ‘net/  
pop’ or is there another Ruby POP3 library where you can do this?

All help, code etc appreciated.

---

<div class="post-metadata">

**Author:** ![dazzle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@dazzle](https://www.ruby-forum.com/u/dazzle)\
**Post date:** [March 8, 2007, 1:30pm UTC](https://www.ruby-forum.com/t/retrieving-email-message-body-only-via-net-pop/88124/2 "2007-03-08T13:30:53Z")

</div>

On Thu, Mar 08, 2007 at 07:35:10PM +0900, dazzle wrote:

> Is it possible to retrieive just the email message body using ‘net/  
> pop’ or is there another Ruby POP3 library where you can do this?

The POP3 protocol (RFC 1939) has a command to retrieve the headers  
without  
the body, but not the body without the headers.

If the library offered a way to retrieve just the body, it would still  
have  
to retrieve the whole lot, and then trim off the head. So you could just  
do  
that yourself:

headers, body = message.split(/\r\n\r\n/, 2)
