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

Use a custom mailer for Reply-To support #1395

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/mailers/PWPushMailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class PWPushMailer < Devise::Mailer
if Settings.mail
if Settings.mail.mailer_sender
default from: Settings.mail.mailer_sender
end

if Settings.mail.mailer_reply_to
default reply_to: Settings.mail.mailer_reply_to
end
end
end

4 changes: 4 additions & 0 deletions config/defaults/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,10 @@ mail:
# Environment Variable Override: PWP__MAIL__MAILER_SENDER='"Password Pusher" <[email protected]>'
# mailer_sender: '"Password Pusher" <[email protected]>'

# Configure the e-mail address which will be shown as 'Reply-To' in emails
# Environment Variable Override: PWP__MAIL__MAILER_REPLY_TO='"Password Pusher" <[email protected]>'
# mailer_reply_to: '"Password Pusher" <[email protected]>'

### Feedback Form
feedback:
# The email that will receive the information filled out by users in the
Expand Down
5 changes: 3 additions & 2 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = Settings.mail.mailer_sender if Settings.mail
# This is now configured in app/mailers/PWPushMailer.rb
# config.mailer_sender = Settings.mail.mailer_sender if Settings.mail

# https://github.com/heartcombo/devise/issues/5439
config.navigational_formats = ['*/*', :html, :turbo_stream]

# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
config.mailer = 'PWPushMailer'

# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
Expand Down
4 changes: 4 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,10 @@ mail:
# Environment Variable Override: PWP__MAIL__MAILER_SENDER='"Password Pusher" <[email protected]>'
# mailer_sender: '"Password Pusher" <[email protected]>'

# Configure the e-mail address which will be shown as 'Reply-To' in emails
# Environment Variable Override: PWP__MAIL__MAILER_REPLY_TO='"Password Pusher" <[email protected]>'
# mailer_reply_to: '"Password Pusher" <[email protected]>'

### Feedback Form
feedback:
# The email that will receive the information filled out by users in the
Expand Down