Open geo767 opened 8 years ago
+1. According to Mailgun guides, it's better to send transactional e-mails (reset password, billing statements, etc.) and marketing e-mails (SPAM) through different domains/subdomains. We'd like to start sending e-mails from multiple domains, and support for dynamic domains would be crucial. My proposals:
A convenient option. If From
is set to blah@abc.def.com
, Mailgun domain is set to abc.def.com
and /v3/abc.def.com end-point is used.
config.mailgun_settings[:domain] = :auto
A flexible option. Do it yourself in run-time.
config.mailgun_settings[:domain] = proc do |message|
# Some code here that returns the domain used to send this very e-mail.
# The object provided lets me access From, Subject, body etc.
end
Although these are two different options, both would use the same mechanism internally. If :domain is set to :auto, the code runs its default proc that takes out the domain from the From
field.
Is it possible to change the domain when sending email?