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,
,但似乎都没有。
答案 0 :(得分:1)
如果您使用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 }