Closed xxx closed 5 years ago
👍
Hey @xxx, thanks for the PR 👍 I think try
would be a bit better. Also, I'm unable to reproduce with a test case:
def test_to_empty
UserMailer.to_field(nil).deliver_now
end
It raises an ArgumentError: SMTP To address may not be blank: []
in Rails 4.2-5.2 in the tests.
@ankane Right - the issue is when you don't call mail
at all. The blank to
is the SMTP error I mentioned (and is why we don't call mail
at all if we run out of users to send to). There is a failing test case in the PR
Wow, totally missed the test case 👌 Looks great, thanks!
I'm upgrading from 0.5.2 to 1.0.2, and we're suddenly seeing errors in mailer tests in cases where the
to
list is whittled down to nothing, so we don't send the mail (callingmail
with a blankto
throws STMP errors), and nil is returned from the mailer methodI don't think the line that sets
:user
changed between the two versions, so I'm not sure if our case is supposed to even make it that far, but the fix was one character, assuming targetted Ruby versions all have the safe navigation operator.