Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set domain while sending email #54

Open
geo767 opened this issue Nov 24, 2015 · 1 comment
Open

Set domain while sending email #54

geo767 opened this issue Nov 24, 2015 · 1 comment

Comments

@geo767
Copy link

geo767 commented Nov 24, 2015

Is it possible to change the domain when sending email?

@Nowaker
Copy link

Nowaker commented Dec 6, 2015

+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 [email protected], 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants