我想用来Sendinblue
从我的 Rails Web 应用程序发送交易电子邮件。
要将我的应用程序配置为使用 Sendinblue,我进行config/environments/production.rb
了如下编辑(注意:fireworks.com
只是一个示例):
Rails.application.configure do
...
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
host = 'fireworks.com'
config.action_mailer.default_url_options = { host: host }
ActionMailer::Base.smtp_settings = {
:address => 'smtp-relay.sendinblue.com',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDINBLUE_USERNAME'],
:password => ENV['SENDINBLUE_PASSWORD'],
:domain => 'fireworks.com',
:enable_starttls_auto => true
}
...
end
我需要任何宝石sib-api-v3-sdk
吗?
我想这个 gem 只对使用 Sendinblue API 发送电子邮件有用。
在 Sendinblue,我验证了我的域“fireworks.com”并创建了一个发件人,noreply@fireworks.com
我将使用它来激活帐户。
app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base
default from: "noreply@fireworks.com"
layout 'mailer'
end
为了让我使用这个发件人,Sendinblue 要我验证(或确认)它。
现在的重点是它noreply@fireworks.com
不存在。Michael Hartl 在他的教程中使用noreply@example.com
,我会使用,noreply@fireworks.com
因为我拥有该fireworks.com
域。
由于我无法验证发件人,我认为唯一的解决方案是在我的服务器中创建noreply
用户帐户,配置 Postfix 以接收来自 Internet 的电子邮件并将 MX 记录添加到我的 DNS 区域。
在收到验证电子邮件之前,我将保持此配置。
这个解决方案有必要吗?我还有其他选择吗?