mandrill_dm
mandrill_dm copied to clipboard
BCC
I was surprised, that MandrillDm::Message
doesn't have #bcc
method. After digging some code I noticed, that we accumulate to
, cc
and bcc
inside #combine_address_fields
and handle BCC this way. But I can't understand, what is the difference between classic bcc
field and custom Mandrillbcc_address
parameter?
Example:
class AlphabetMailer < ActionMailer::Base
def a
mail(from: '[email protected]',
to: '[email protected]',
bcc: '[email protected]',
subject: 'Alpha',
body: '',
delivery_method: :mandrill)
end
def b
mail(from: '[email protected]',
to: '[email protected]',
bcc_address: '[email protected]',
subject: 'Beta',
body: '',
delivery_method: :mandrill)
end
end
# AlphabetMailer.a.deliver_now and AlphabetMailer.b.deliver_now work the same as expected.
Guys, I'm afraid my question is not relevant and I should dig somewhere else, so please can you share your thoughts?
@Tensho - I also tried to use the bcc
method but it was not picking up the merge vars
which I passed in the with the rcpt parameter.
bcc_address
: an optional address to receive an exact copy of each recipient's email (Ref: https://mandrillapp.com/api/docs/messages.html )
I was saved by bcc address parameter. It sends the exact copy of the recipient's email. If you want to send bcc email with this gem please use the bcc_address
parameter.
I guess to be consolidated with ActioMailer
API mandrill_dm should expose #bcc
method and use #bcc_address
method/parameter under the hood. This allows just to switch delivery method in ActionMailer::Base#mail
call without the need to have the conditional clause for BCC option. Does it make sense?