Created
September 2, 2013 07:15
-
-
Save ravionrails/6409990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in action---------- | |
Mail.defaults do | |
retriever_method :imap, | |
:address => "imap.gmail.com", | |
:port => 993, | |
:user_name => 'email_id', | |
:password => '*******', | |
:enable_ssl => true | |
end | |
@mails = Mail.find(:what => :last, :order => :desc, :count => 10) | |
@mails = @mails.to_a | |
in view-------------------------- | |
<% @mails.each do |mail| %> | |
<div class="border_bottom"> | |
<% if mail.multipart? | |
email_html = mail.html_part.body #parsing of html content of the email | |
email_text = mail.text_part.body.decoded # parsing of text content of the email | |
else | |
email_html = mail.body # in this case its a plain email so html body is same as text body.. | |
email_text = mail.body.decoded | |
email_attachments = [] # no attachments :) | |
end | |
%> | |
<%= email_html %> | |
</div> | |
<% end %> | |
Output------------------ | |
</u>�<u></u></span></p><p class="MsoNormal"> <span lang="EN-US">Dear Sir/Madam,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u>�<u> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment