0

我想用来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 区域。
在收到验证电子邮件之前,我将保持此配置。
这个解决方案有必要吗?我还有其他选择吗?

4

1 回答 1

1

现在的重点是 noreply@fireworks.com 不存在。

在继续之前,我想指出,这最终不是一个好的做法。您需要一些地址来接收和识别退回邮件。

话虽如此,我刚刚查看了他们的文档,它在这里说,您可以通过 DNS 条目、文件上传或向他们发送电子邮件来验证整个域,而不是验证单个电子邮件地址。

于 2020-01-12T13:45:04.190 回答