# Extract the message body with gmailer

**URL:** <https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044>\
**Category:** Ruby\
**Created:** [February 13, 2008, 8:01pm UTC](https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044 "2008-02-13T20:01:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [February 13, 2008, 8:01pm UTC](https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044/1 "2008-02-13T20:01:33Z")

</div>

Hi,

Does anyone know how extract the message body from a single inbox mail  
in gmailer?

Aidy

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [February 14, 2008, 2:10am UTC](https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044/2 "2008-02-14T02:10:57Z")

</div>

On Feb 13, 1:58 pm, aidy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> Does anyone know how extract the message body from a single inbox mail  
> in gmailer?
> 
> Aidy

try GMailer

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [February 14, 2008, 5:11pm UTC](https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044/3 "2008-02-14T17:11:32Z")

</div>

Hi,

The problem I am having is that the msg body is no consistently  
returned

def check\_purchase\_email  
@g = nil  
@msg = nil  
GMailer.connect(:username=\>‘removed\_email\_address@domain.invalid’,:password=\>‘xxxxxxxx’) do |@g|  
@g.messages(:label=\>‘inbox’, :read=\>false).each\_msg {|@msg|  
puts "subject: " + @msg.subject  
puts "from: " + @msg.sender  
puts @msg.body  
}  
end  
@g.disconnect  
end

Cheers

Aidy

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [February 14, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044/4 "2008-02-14T17:24:40Z")

</div>

On Wed, Feb 13, 2008 at 1:00 PM, aidy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Does anyone know how extract the message body from a single inbox  
> mail in gmailer?

Not exactly the question you are asking, but you do know that GMail has  
IMAP and POP3 interfaces, right?

HTH,

Marcelo

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [February 15, 2008, 8:51am UTC](https://www.ruby-forum.com/t/extract-the-message-body-with-gmailer/129044/5 "2008-02-15T08:51:37Z")

</div>

Hi,

> Hi,
> 
> The problem I am having is that the msg body is no consistently  
> returned
> 
> def check\_purchase\_email  
> @g = nil  
> @msg = nil  
> GMailer.connect(:username=\>‘removed\_email\_address@domain.invalid’,:password=\>‘xxxxxxxx’) do |@g|  
> @g.messages(:label=\>‘inbox’, :read=\>false).each\_msg {|@msg|  
> puts "subject: " + @msg.subject  
> puts "from: " + @msg.sender  
> puts @msg.body  
> }  
> end  
> @g.disconnect  
> end
> 
> Cheers
> 
> Aidy

As a maintainer of gmailutils, I recommend not using gmailer any more.

GMailer is unstable and might not working under a certain circumstance.

If you have any question about gmailer, send email to me.

Regards,

Park H.  
phasis at gmail dot com
