How to remove the "Start Forwarding" message: part of the email body in rails 3 application

I get a redirected email address in my rails 3 application and it works fine.

But in the forwarded letter, it includes the following message at the top, for example:

Begin forwarded message:

From: roger rabbit <sales@mysite.com>
Date: 23 May 2011 13:52:08 GMT+01:00
To: sam@yoursite.com
Subject: Hi threre

Dear Mike 

Yes please do the work for me!

This format changes with respect to which email client sent the message.

I want to cut this out of the body, so I can only show the redirected message like this:

Dear Mike 

Yes please do the work for me!

What is the best way to do this, as I know I can do this for this particular format, but I need it to be more general / smart.

Is there any gem / lib I should use?

Any help would be great.

thanks Rick

+3
source share
2

, , :

  • " :", , .
  • , .

1: , (, ) ":". , , "From:" (, ), . " :", .

2: , . -, "From:" "To:" .., , , .

(, ), , . , , , .

0

, split String. - :

, a-variable .

b = a.split("\n\r\n", 3) maybe b = a.split("\n\n", 3)

(\n\n ) .

, , :

c = b[2].to_s 

puts c => "Dear Mike \n\nYes please do the work for me!\n"

,

0

All Articles