我正在尝试创建一个电子邮件地址。我已经添加了sendgrid插件到我的应用程序。
这是我的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.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.mydomain.com",
:port => 25,
:user_name => "mail@mydomain.com",
:password => "mypass",
:authentication => :login
}
end
end
您需要更改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']
要创建像mail@yourdomain.com这样的常规电子邮件,您需要一个Mail exchange主机。
当你选择了你的邮件交换主机,你可以创建电子邮件mail@yourdomain.com
现在您需要在DNS服务器上设置Mx记录
如果你有一个电子邮件,比如mail@yourdomain.com
看起来不像你需要在Heroku上使用SendGrid的代码-文档有你需要的所有细节,在这里