# Imap and Tmail. Getting whole email with imap

**URL:** <https://www.ruby-forum.com/t/imap-and-tmail-getting-whole-email-with-imap/155545>\
**Category:** Ruby\
**Created:** [December 13, 2008, 6:55am UTC](https://www.ruby-forum.com/t/imap-and-tmail-getting-whole-email-with-imap/155545 "2008-12-13T06:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [December 13, 2008, 6:55am UTC](https://www.ruby-forum.com/t/imap-and-tmail-getting-whole-email-with-imap/155545/1 "2008-12-13T06:55:22Z")

</div>

Hi Im finding the imap docs to be a bit hard to understand. Ive also  
searched on these forums but cant find the answer i need.

I can access my gmail account via imap fine and i can use “fetch” to  
pull various parts of my emails out using parameters “ENVELOPE” or  
“BODY[TEXT]”.

I want to use Tmail and it requires a complete email in its “raw” (as it  
says on its site) state but how do i use imap to do this. So far i can  
only grab parts of the messge using those parameters above e.g.  
Envelope.attr[:subject] etc and i cant find a parameter in the docs that  
just gives you the email in full.

anyone help me on this one?

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [December 16, 2008, 12:04am UTC](https://www.ruby-forum.com/t/imap-and-tmail-getting-whole-email-with-imap/155545/2 "2008-12-16T00:04:25Z")

</div>

On Dec 12, 2008, at 21:48 PM, Adam A. wrote:

> only grab parts of the messge using those parameters above e.g.  
> Envelope.attr[:subject] etc and i cant find a parameter in the docs  
> that  
> just gives you the email in full.
> 
> anyone help me on this one?

Read:

[http://www.rfc-editor.org/rfc/rfc3501.txt](http://www.rfc-editor.org/rfc/rfc3501.txt) Section 6.4.5 (page 53)

You can probably get away with ALL. Otherwise ENVELOPE BODY will get  
what you want. If you don’t want to mark the message as read, use  
BODY.PEEK
