bradpauly/griddler-mailgun

BCC coming in as params[:recipient]

Closed this issue · 4 comments

rzane commented

My mailgun route looks like this:

match_recipient("^something")

When I send an email with a BCC of something@mydomain.com, email.bcc will be an empty array. However params[:recipient] will be something@mydomain.com.

I'm curious if there's a decent way to handle this. My current solution involves a monkeypatch:

module NormalizationWithRecipient
  def normalize_params
    super.tap { |result| result[:bcc] << params[:recipient] }
  end
end

Griddler::Mailgun::Adapter.prepend NormalizationWithRecipient

Is the BCC info you want available in the headers? Mailgun doesn't send it as a param (except as recipient like you said).

rzane commented

No, it's not available in the headers. Maybe Griddler::Email should have a reader for params. Then, each adapter could return extra params from normalized_params.

This is more of an upstream issue though, so I'm going to close.

There has been some discussion about making provider specific params available via Griddler::Email. I think it has been targeted for v2.

rzane commented

👍