2

I am deploying an ruby-on-rails app in Heroku.I cannot add the SendGrid add-on to the heroku account.Is there any other ways to use the email services?

swetha pvl
  • 163
  • 1
  • 10

2 Answers2

3

You could use your Gmail account. In config > environment > production.rb

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => 'gmail.com',
  :user_name => ENV['GMAIL_USER_NAME'],
  :password => ENV['GMAIL_PASSWORD'],
  :authentication => 'plain',
  :enable_starttls_auto => true 
}

Then you have to set GMAIL_USER_NAME and GMAIL_PASSWORD to Heroku configs

GMAIL_USER_NAME should be your email address of gmail domain eg. sample@gmail.com

Ojash
  • 1,234
  • 8
  • 20
3

Yes you can simply sign up for a SendGrid account directly and then use the SMTP details. It would look like this:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
    :address => "smtp.sendgrid.net",
    :port => 587,
    :domain => 'yourdomain.com',
    :user_name => ENV['SENDGRID_USERNAME'],
    :password => ENV['SENDGRID_PASSWORD'],
    :authentication => 'plain',
    :enable_starttls_auto => true 
}

There's also an example using the Mail gem, in the SendGrid documentation.

Martyn Davies
  • 1,493
  • 9
  • 12