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

Introduce suspenders:email generator #1162

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

stevepolitodesign
Copy link
Contributor

@stevepolitodesign stevepolitodesign commented Feb 27, 2024

Creates email interceptor to ensure emails are sent to preconfigured
addresses in non-production environments. Drops support for Recipient
Interceptor
, since this functionality is supported in Rails Core.

In order to enable the interceptor, set EMAIL_RECIPIENTS to a
comma-separated list.

INTERCEPTOR_ADDRESSES="[email protected],[email protected]" bin/rails s

Configures default_url_options in test and development
environments so that *_url helpers will work.

Note that we do not configure production, since we've determined the
delivery_method is something each project will configure
independently. This means we'll just use the default configuration,
which is smtp.

@stevepolitodesign stevepolitodesign changed the base branch from main to suspenders-3-0-0 February 27, 2024 14:22
Comment on lines 35 to 49
def configure_development_environment
environment %(config.action_mailer.default_url_options = { host: "localhost", port: 3000 }), env: "development"
end

def configure_test_environment
environment %(config.action_mailer.default_url_options = { host: "www.example.com" }), env: "test"
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These might be able to be removed if rails/rails#51191 is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove once there's a new release.

Comment on lines 35 to 49
def configure_development_environment
environment %(config.action_mailer.default_url_options = { host: "localhost", port: 3000 }), env: "development"
end

def configure_test_environment
environment %(config.action_mailer.default_url_options = { host: "www.example.com" }), env: "test"
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also noting I didn't need to config.asset_host. Everything worked without issue in test and development.

@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-email branch 4 times, most recently from c82f2ea to c1ecef7 Compare February 28, 2024 10:27
@stevepolitodesign stevepolitodesign marked this pull request as ready for review February 28, 2024 10:28
Creates [email interceptor][] to ensure emails are sent to preconfigured
addresses in non-production environments. Drops support for [Recipient
Interceptor][], since this functionality is supported in Rails Core.

In order to enable the interceptor, set `EMAIL_RECIPIENTS` to a
comma-separated list.

```sh
INTERCEPTOR_ADDRESSES="[email protected],[email protected]" bin/rails s
```

Configures [default_url_options][] in `test` and `development`
environments so that `*_url` helpers will work.

Note that we do not configure `production`, since we've determined the
`delivery_method` is something each project will configure
independently. This means we'll just use the [default configuration][],
which is `smtp`.

[email interceptor]: https://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
[Recipient Interceptor]: https://github.com/croaky/recipient_interceptor
[default_url_options]: https://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views
[default configuration]: https://guides.rubyonrails.org/configuring.html#config-action-mailer-delivery-method
@stevepolitodesign stevepolitodesign merged commit fc8793d into suspenders-3-0-0 Feb 28, 2024
2 checks passed
@stevepolitodesign stevepolitodesign deleted the suspenders-3-0-0-email branch February 28, 2024 19:12
stevepolitodesign added a commit that referenced this pull request May 10, 2024
Creates [email interceptor][] to ensure emails are sent to preconfigured
addresses in non-production environments. Drops support for [Recipient
Interceptor][], since this functionality is supported in Rails Core.

In order to enable the interceptor, set `EMAIL_RECIPIENTS` to a
comma-separated list.

```sh
INTERCEPTOR_ADDRESSES="[email protected],[email protected]" bin/rails s
```

Configures [default_url_options][] in `test` and `development`
environments so that `*_url` helpers will work.

Note that we do not configure `production`, since we've determined the
`delivery_method` is something each project will configure
independently. This means we'll just use the [default configuration][],
which is `smtp`.

[email interceptor]: https://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
[Recipient Interceptor]: https://github.com/croaky/recipient_interceptor
[default_url_options]: https://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views
[default configuration]: https://guides.rubyonrails.org/configuring.html#config-action-mailer-delivery-method
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

Successfully merging this pull request may close these issues.

2 participants