我一直在使用 Rails 3,关于发送真实电子邮件的部分。当我运行该功能向我的 gmail 帐户发送电子邮件时,我收到了邮件,但发件人地址也设置为我的 gmail,而不是ticketee@gmail.com
. 我也有默认的 :from setup :
class Notifier < ActionMailer::Base
default from: "ticketee@gmail.com"
def comment_updated(comment, user)
@comment = comment
@user = user
mail from: "ticketee@gmail.com", to: user.email, subject: "[ticketee] #{comment.ticket.project.name} - #{comment.ticket.title}"
end
end
关于为什么会发生这种情况的任何想法?
编辑
将上面的地址从地址更改为我的 gmail,我不再得到 nil 作为测试响应。但是,它似乎遇到了另一个问题:
Then there should be an email from Ticketee in my box # features/step_definitions/app_email_steps.rb:20
deadlock; recursive locking (ThreadError)
<internal:prelude>:8:in `lock'
<internal:prelude>:8:in `synchronize'
./features/step_definitions/app_email_steps.rb:22:in `block (2 levels) in <top (required)>'
<internal:prelude>:10:in `synchronize'
./features/step_definitions/app_email_steps.rb:21:in `/^there should be an email from Ticketee in my box$/'
features/gmail.feature:32:in `Then there should be an email from Ticketee in my box'
Failing Scenarios:
cucumber features/gmail.feature:20 # Scenario: Receiving a real-world email