notification message

Just curious, I’d like to shoot off a notification message once a form has been entered on my site.

I guess it’s easy enough to figure out. Do I just create a mailer and call that task once it’s completed?

(sorry I haven’t worked with any mailers yet.)

Thanks,

Joe

Ok, I think I’ve got it figured out.

Thanks,

Joe

You can post your solution, maybe it will help others in the future.

oh, it wasn’t too hard.

I followed most of this -> http://guides.rubyonrails.org/action_mailer_basics.html

basically generated a mailer

‘rails generate mailer Interview_Notification’

it created the mailer(s) and views I needed.

class InterviewNotificationMailer < ActionMailer::Base

  default from: "jguerra@jginfosys.com"

  # Subject can be set in your I18n file at config/locales/en.yml
  # with the following lookup:

Oh, I almost forgot. There are necessary additions needed to send mail from your production environment (heroku in my case).

I used the gem ‘sendgrid-ruby’…

You need to add the sendgrid resource on heroku (enable it)

need to add this configuration to the production environment…


config.action_mailer.default_url_options = { :host => 'www.jginfosys.com', :protocol => 'https'
}

and added this to the ... environment.rb

ActionMailer::Base.smtp_settings = {
:user_name => ENV[‘SENDGRID_USERNAME’],
:password => ENV[‘SENDGRID_PASSWORD’],
:domain => ‘www.jginfosys.com’,
:address => ‘smtp.sendgrid.net’,
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}

Of course, change your host and domain to match yours.