# Problem with net/imap

**URL:** <https://www.ruby-forum.com/t/problem-with-net-imap/60474>\
**Category:** Ruby\
**Created:** [May 14, 2006, 1:35pm UTC](https://www.ruby-forum.com/t/problem-with-net-imap/60474 "2006-05-14T13:35:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thiago\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@Thiago\_J](https://www.ruby-forum.com/u/Thiago_J)\
**Post date:** [May 14, 2006, 1:35pm UTC](https://www.ruby-forum.com/t/problem-with-net-imap/60474/1 "2006-05-14T13:35:56Z")

</div>

Hi all,

I’ve been struggling for the past hour to get just the message text  
itself  
from the body but I can’t figure out, all I get is the entire body which  
contains all the headers, etc…

This is what I’m doing…

imap = IMAP.new(server)  
imap.authenticate(‘LOGIN’, login, passwd)  
imap.examine(‘INBOX’)  
imap.uid\_fetch(uid, “BODY[]”).first.attr[“BODY[]”]

Any help would be appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![Thiago\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@Thiago\_J](https://www.ruby-forum.com/u/Thiago_J)\
**Post date:** [May 15, 2006, 9:00pm UTC](https://www.ruby-forum.com/t/problem-with-net-imap/60474/2 "2006-05-15T21:00:31Z")

</div>

On May 14, 2006, at 4:34 AM, Thiago J. wrote:

> imap.examine(‘INBOX’)  
> imap.uid\_fetch(uid, “BODY[]”).first.attr[“BODY[]”]
> 
> Any help would be appreciated.

You want BODY[TEXT]. See RFC 2060:

ftp://ftp.rfc-editor.org/in-notes/rfc2060.txt

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![Thiago\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@Thiago\_J](https://www.ruby-forum.com/u/Thiago_J)\
**Post date:** [May 15, 2006, 10:05pm UTC](https://www.ruby-forum.com/t/problem-with-net-imap/60474/3 "2006-05-15T22:05:08Z")

</div>

Thanks Eric, I had figured out about 20 min after I posted to the  
list, but will look at the file you sent.
