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

Document action_mailer.file_settings [ci-skip] #50365

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

mkasberg
Copy link
Contributor

@mkasberg mkasberg commented Dec 15, 2023

Motivation / Background

I was reading the Action Mailer guide and noticed the settings and defaults for the :file delivery method were poorly documented. These docs were originally added back in #13728. #44422 added links to the relevant sections of the Configuration guide, but did not link config.action_mailer.file_settings because the Configuration guide is actually missing that section.

Detail

I added a short section to the Configuration guide for config.action_mailer.file_settings and linked to it from the Action Mailer guide, following the style of the other delivery methods. Like other delivery methods, the relevant options for file_settings come from the allowed options of the Mail::FileDelivery class in the mail gem.

Additional information

Here's where Rails sets up this delivery method with the default location:

add_delivery_method :file, Mail::FileDelivery,
location: defined?(Rails.root) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails"

And here's where the mail gem uses the options:
https://github.com/mikel/mail/blob/10a4443b9d4ffa71b9ad643ad86cc23ccc99f0f3/lib/mail/network/delivery_methods/file_delivery.rb#L21

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [N/A] Tests are added or updated if you fix a bug or add a feature.
  • [N/A] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

I was reading the Action Mailer guide and noticed the settings and
defaults for the `:file` delivery method were poorly documented. These
docs were originally added back in rails#13728. rails#44422 added links to the
relevant sections of the Configuration guide, but did not link
`config.action_mailer.file_settings` because the Configuration guide is
actually missing that section.

I added a short section to the Configuration guide for
`config.action_mailer.file_settings` and linked to it from the Action
Mailer guide, following the style of the other delivery methods. Like
other delivery methods, the relevant options for `file_settings` come
from the allowed options of the `Mail::FileDelivery` class in the mail
gem.

Here's where Rails sets up this delivery method with the default
location:
https://github.com/rails/rails/blob/9064735ec5cd3c679f8ffabc42532dd85223af58/actionmailer/lib/action_mailer/delivery_methods.rb#L30-L31

And here's where the mail gem uses the options:
https://github.com/mikel/mail/blob/10a4443b9d4ffa71b9ad643ad86cc23ccc99f0f3/lib/mail/network/delivery_methods/file_delivery.rb#L21
@rails-bot rails-bot bot added the docs label Dec 15, 2023
@p8
Copy link
Member

p8 commented Dec 16, 2023

Thanks @mkasberg . This looks good to me.
@skipkayhil Any idea why this could be missed by bin/check-config-docs?

@p8 p8 merged commit 4876fbd into rails:main Dec 16, 2023
3 checks passed
@mkasberg mkasberg deleted the action-mailer-guide branch December 16, 2023 14:16
@skipkayhil
Copy link
Member

skipkayhil commented Dec 17, 2023

@skipkayhil Any idea why this could be missed by bin/check-config-docs?

Yeah, I haven't actually implemented that for any of the frameworks' configuration, just config.* itself 😅

I've definitely had this as something on my mind to do recently, if I have time I'll see if I can find time to work on it this week

@p8
Copy link
Member

p8 commented Dec 17, 2023

@skipkayhil great! 😄

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

Successfully merging this pull request may close these issues.

None yet

3 participants