Created
July 14, 2012 23:37
-
-
Save aalinat/3113881 to your computer and use it in GitHub Desktop.
rails inline attachment
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
<h2>New Message!</h2> | |
<p>Priority:</p> | |
<%=@priority%> | |
<p> | |
<%= image_tag attachments['image.jpg'].url %> | |
</p> | |
<p> | |
<%=@description%> | |
</p> |
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
class Testmailer < ActionMailer::Base | |
default :from => "[email protected]" | |
def do_contact(subject,description,attachment,priority) | |
@description = description | |
@priority = priority | |
if attachment | |
attachments.inline['image.jpg'] = File.open(attachment.path, 'rb'){|f| f.read} | |
end | |
mail(:to => "[email protected]", :subject => subject) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment