Forum: Ruby on Rails Accessing just the body of email in text format?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
softwareengineer 99 (Guest)
on 2006-02-17 07:57
(Received via mailing list)
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
softwareengineer 99 (Guest)
on 2006-02-17 08:28
(Received via mailing list)
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
softwareengineer 99 (Guest)
on 2006-02-17 19:51
(Received via mailing list)
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.
  <span style="font-size: 12pt; font-family: &quot;Times New
Roman&quot;;">This is my first blog post via email and I am  happy about
it.<br>    </span><p>
                   <hr size=1> Yahoo! Mail<br>
  <a
href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=38...
Photomail</a> 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
This topic is locked and can not be replied to.