Im using Sinatra and this gem, and Im able to send email ok. However, when I send an ERB file, it comes through as plain text and it doesnt render the ruby code. For example:
mail = Mail.deliver do
to user_email
from 'support@iconosites.com'
subject 'Your Upgrade is being processed'
body File.read('views/email.erb')
end
Is there a way to have it render the Ruby code?
Thanks!!
I haven’t tested this but it looks like you’re trying to render an erb template as the body of your email.
I think you’d need to do something more along the lines of:
There’s a couple of email examples on the ruby-docs page for erb templates here also: http://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html