The Error I get:
ActionView::Template::Error (undefined method `url' for nil:NilClass)
I have this attachment that is comming up nil
<%= image_tag attachments['tippedlogods.png'].url %>
That being said, I have declared the attachment in the method to send the email, here:
def confirmation(order)
@order = order
mail(to: @order.email, subject: "Order Confirmation", content_type: "text/html")
attachments.inline['tippedlogods.png'] = File.read("app/assets/images/tippedlogods.png")
end
In my production.rb:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => 'hidden-peak-xxxx.heroku.com', :only_path => false}
config.action_mailer.asset_host = 'hidden-peak-xxxx.heroku.com'
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN'],
:authentication => :plain
}
Is this not the way to go about sending an image in a confirmation email?
I was following RoR Guides here...
Note Rails 4~