Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rails 3 - Action Mailer not sending message
- <%= button_to 'Buy', review_hvacs_path(:b => true, :h => hvac, :a => params[:a], :s => params[:s]) %>
- @buy = params[:b]
- if !@buy.nil?
- @currentHvac = Hvac.find(params[:h])
- @supplier = HvacSupplier.find(@currentHvac.hvac_supplier_id)
- Notifier.gmail_message(@supplier)
- end
- # Don't care if the mailer can't send
- config.action_mailer.raise_delivery_errors = false
- config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = {
- :enable_smarttls_auto => true,
- :address => 'smtp.gmail.com',
- :port => 587,
- :authentication => :plain,
- :domain => 'gmail.com',
- :username => '<my email address>@gmail.com',
- :password => '<my password>'
- }
- class Notifier < ActionMailer::Base
- default from: "user@address.com"
- # Subject can be set in your I18n file at config/locales/en.yml
- # with the following lookup:
- #
- # en.notifier.gmail_message.subject
- #
- def gmail_message(supplier)
- @greeting = "HVAC Equipment Purchase"
- @supplier = supplier
- mail(:to => supplier.email, :subject => "HVAC Equipment Enquiry")
- end
- end
- Notifier#gmail_message
- <%= @greeting %>, I am interesting in purchasing replacement equipment, and would like an evaluation.
Add Comment
Please, Sign In to add comment