Skip to content

Instantly share code, notes, and snippets.

@aalinat
Created July 14, 2012 23:37
Show Gist options
  • Save aalinat/3113881 to your computer and use it in GitHub Desktop.
Save aalinat/3113881 to your computer and use it in GitHub Desktop.
rails inline attachment
<h2>New Message!</h2>
<p>Priority:</p>
<%=@priority%>
<p>
<%= image_tag attachments['image.jpg'].url %>
</p>
<p>
<%=@description%>
</p>
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