开发者

Heroku actionmailer how to

I am trying to create an email adress. I have added the sendgrid plugin to my app.

Here is my application.rb

module Konkurranceportalen
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    #  all .rb files in that directory are automatically loaded.
    config.action_mailer.del开发者_高级运维ivery_method = :smtp
    ActionMailer::Base.smtp_settings = {
  :address  => "smtp.mydomain.com",
  :port  => 25,
  :user_name  => "mail@mydomain.com",
  :password  => "mypass",
  :authentication  => :login
}
end
end


You need to change your settings for Sendgrid:

 ActionMailer::Base.smtp_settings = {
  :address        => "smtp.sendgrid.net",
  :port           => "25",
  :authentication => :plain,
  :user_name      => ENV['SENDGRID_USERNAME'],
  :password       => ENV['SENDGRID_PASSWORD'],
  :domain         => ENV['SENDGRID_DOMAIN']


To create an regular email like mail@yourdomain.com you need an Mail Exhange host.

When you have choicen your mail exhange host you can create emails like mail@yourdomain.com

Now you need to setup the Mx record on you DNS server

And vola you have a email like mail@yourdomain.com


that doesn't look like the code you need to use SendGrid with on Heroku - the docs have all the details you need, here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜