Accessing just the body of email in text format?


#1

I am interested in accessing the body of the email in text format using
IMAP to receive emails.

So far I have tried the following

  #body = imap.fetch(message_id, "BODY[TEXT]")
  #body = imap.fetch(message_id, ["BODY[]"])[0].attr['BODY[]']

But both of the above give me body text + the headers including
Content-Type etc. How can I access just the body in text format.

I appreciate your assistance.

Thanks
Frank


#2

I have gotten to the part where I can access the body of the email with

email.body

after passing it to my receiver function using

body = imap.fetch(message_id, [“BODY[]”])[0].attr[‘BODY[]’]

The problem now is that I get both a text version of the email as well
as the HTML version of the email.

How can I just get the text version of the email.

Thanks
Frank

softwareengineer 99 removed_email_address@domain.invalid wrote: I am
interested in accessing the body of the email in text format using IMAP
to receive emails.

So far I have tried the following

  #body = imap.fetch(message_id, "BODY[TEXT]")
  #body = imap.fetch(message_id, ["BODY[]"])[0].attr['BODY[]']

But both of the above give me body text + the headers including
Content-Type etc. How can I access just the body in text format.

I appreciate your assistance.

Thanks
Frank


Relax. Yahoo! Mail virus scanning helps detect nasty
viruses!_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#3

Experts, I appreciate any pointers you can provide on how I can
access/split the message in text form and/or extract the text only
version from text and html?

Currently I am able to get to this part:


This is my first blog post via email and I am happy about it.


Yahoo! Mail
Use Photomail to share photos without annoying attachments.
This is my first blog post via email and I am happy about
it.



Yahoo! Mail

Use
Photomail
to share photos without annoying attachments.

As you can see the HTML post follows the text post in the same
message. How can I leave the duplicate HTML copy out?

Many Thanks for your assistance
Frank

softwareengineer 99 removed_email_address@domain.invalid wrote: I have gotten
to the part where I can access the body of the email with

email.body

after passing it to my receiver function using

body = imap.fetch(message_id, [“BODY[]”])[0].attr[‘BODY[]’]

The problem now is that I get both a text version of the email as well
as the HTML version of the email.

How can I just get the text version of the email.

Thanks
Frank

softwareengineer 99 removed_email_address@domain.invalid wrote: I am
interested in accessing the body of the email in text format using IMAP
to receive emails.

So far I have tried the following

  #body = imap.fetch(message_id, "BODY[TEXT]")
  #body = imap.fetch(message_id, ["BODY[]"])[0].attr['BODY[]']

But both of the above give me body t ext + the headers including
Content-Type etc. How can I access just the body in text format.

I appreciate your assistance.

Thanks
Frank


Relax. Yahoo! Mail virus scanning helps detect nasty
viruses!_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


What are the most popular cars? Find out at Yahoo! Autos


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails