[英]rails application not sending email
Developerment.rb
myapp::Application.configure do
config.cache_classes = false
#config.whiny_nils = true
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
#config.action_mailer.delivery_method = :sendmail
config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin
# config.log_level = :error
end
#log ActiveRecord
ActiveRecord::Base.logger = Logger.new(STDOUT) if defined? Rails::Console
我在日志文件中看到消息“已發送郵件到name1.name2@domain.com”。 我玩過這條線
#config.action_mailer.delivery_method = :sendmail
通過取消注釋,並給了所有這些選項:smtp, :sendmail or :test,
但似乎沒有一個起作用。
如果使用SMTP發送電子郵件,請確保在config / environments / $ RAILS_ENV.rb文件中包括服務器配置。 這是一個例子:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: '<username>',
password: '<password>',
authentication: 'plain',
enable_starttls_auto: true }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.