设置 action mailer 发不出邮件 development.rb:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.163.com",
port: 25,
domain: "163.com",
authentication: :login,
user_name: "[email protected]",
password: "password",
enable_starttls_auto: true
}
enable_starttls_auto 我换过 false,还是不行吧 notifiler.rb
class Notifier < ActionMailer::Base
default from: "[email protected]"
def order_received(order)
@order=order
mail :to=>order.email, subject:'Lumos'
end
调用 deliver() 发送 orders_controller.rb
Notifier.order_received(@order).deliver
log 信息: Sent mail to [email protected] (25831.2ms) Date: Tue, 18 Mar 2014 21:44:43 +0800 From: [email protected] To: [email protected] Message-ID: <[email protected]> Subject: Lumos Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit
Notifier#order_received
Hi, find me in app/views/app/views/notifier/order_received.text.erb
Dear casd HeHe. You ordered the following items: 1 x HIMYM We'll send you a separate e-mail when your order ships.
Redirected to http://0.0.0.0:3000/store/index Completed 302 Found in 26430ms (ActiveRecord: 528.0ms)
问题出在哪?怎么改? 谢谢。