Ruby on Rails
Monday, October 8, 2018
On Saturday, October 6, 2018 at 3:27:31 AM UTC-5, Prasanth Balan wrote:
-- Hi All,I need to configure SMTP on production,My client only providing address, is that possible without user_name & password to configure SMTP ?
What is your host? If you are using Heroku you can configure SendGrid starter and it will provide a username and password for the mail server it creates for you.
Provision SendGrid like
More information can be found here: https://devcenter.heroku.com/articles/sendgrid
To use the SMTP mailer you will need to setup an initializer class with something like the following:
Provision SendGrid like
heroku addons:create sendgrid:starter
Then grab your environment vars with
heroku config:get SENDGRID_USERNAME
heroku config:get SENDGRID_PASSWORD
More information can be found here: https://devcenter.heroku.com/articles/sendgrid
To use the SMTP mailer you will need to setup an initializer class with something like the following:
So, in config/initializers/setup_mail.rb
ActionMailer::Base.delivery_method = :smtpActionMailer::Base.smtp_settings = {:address => 'smtp.sendgrid.net',:port => '587',:authentication => :plain,:user_name => ENV['SENDGRID_USERNAME'],:password => ENV['SENDGRID_PASSWORD'],:domain => 'heroku.com',:enable_starttls_auto => true}
Create a mailer template and invoke from your controller of choice and you've got a working mail in production.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8e4fac18-7433-44d6-bb7f-d67b6e49c552%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment