簡體   English   中英

為設計發送郵件

[英]Sending mail for devise

我正在嘗試從我的 rails 應用程序通過 sendgrid 發送郵件。 我之前已經設置了 sendgrid。 我能夠在開發和生產中通過 heroku 發送和接收郵件。 一切都工作了一天。 幾天后我回來了,沒有任何效果。

沒有錯誤。 在開發中,它說郵件已發送,但電子郵件未發送,並且與生產相同。

這是我的設置:

發展.rb

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

生產.rb

config.action_mailer.default_url_options = { host: 'herokuapp.com' }
Rails.application.routes.default_url_options[:host] = 'herokuapp.com' 
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"

setup_mail.rb

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
    address:                'smtp.sendgrid.net',
    port:                   '587',
    :authentication         => :plain,
    user_name:              'user',
    password:               'pass',
    domain:                 'herokuapp.com',
    enable_starttls_auto: true
}

我曾嘗試將我的通行證重置為 sendgrid 並刪除然后重新添加它,但后來我遇到了一個錯誤,提示“用戶被禁止”,我無法重新添加它。

我也嘗試切換到郵戳,結果類似,郵件從未收到但已發送。

如果他們收到您的電子郵件請求,您應該檢查 Sendgrid。

文檔

在電子郵件活動中搜索電子郵件。 如果我們成功傳遞了消息,您將看到帶有傳遞時間的傳遞事件。 如果您沒有看到電子郵件出現,您可以單擊搜索選項並確保選中處理和延遲。 已處理事件表明我們確實收到了您的請求。 延遲事件顯示接收郵件的接收服務器是否存在問題或延遲。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM