discourse/app/services
Martin Brennan eb2c399445
FEATURE: Use group SMTP settings for sending user notification emails (initial) (#13220)
This PR changes the `UserNotification` class to send outbound `user_private_message` using the group's SMTP settings, but only if:

* The first allowed_group on the topic has SMTP configured and enabled
* SiteSetting.enable_smtp is true
* The group does not have IMAP enabled, if this is enabled the `GroupSMTPMailer` handles things

The email is sent using the group's `email_username` as both the `from` and `reply-to` address, so when the user replies from their email it will go through the group's SMTP inbox, which needs to have email forwarding set up to send the message on to a location (such as a hosted site email address like meta@discoursemail.com) where it can be POSTed into discourse's handle_mail route.

Also includes a fix to `EmailReceiver#group_incoming_emails_regex` to include the `group.email_username` so the group does not get a staged user created and invited to the topic (which was a problem for IMAP), as well as updating `Group.find_by_email` to find using the `email_username` as well for inbound emails with that as the TO address.

#### Note

This is safe to merge without impacting anyone seriously. If people had SMTP enabled for a group they would have IMAP enabled too currently, and that is a very small amount of users because IMAP is an alpha product, and also because the UserNotification change has a guard to make sure it is not used if IMAP is enabled for the group. The existing IMAP tests work, and I tested this functionality by manually POSTing replies to the SMTP address into my local discourse.

There will probably be more work needed on this, but it needs to be tested further in a real hosted environment to continue.
2021-06-03 14:47:32 +10:00
..
spam_rule FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
anonymous_shadow_creator.rb FIX: ensures shadow has last_posted_at before comparing to site setting (#10374) 2020-08-05 13:20:51 +02:00
badge_granter.rb DEV: raises a GrantError instead of a log and a variable exception (#12875) 2021-04-28 20:05:45 +02:00
color_scheme_revisor.rb FEATURE: User selectable color schemes (#10544) 2020-08-28 10:36:52 -04:00
destroy_task.rb FIX: do not send rejection emails to auto-deleted reviewable users (#12160) 2021-02-22 18:37:47 +05:30
email_settings_exception_handler.rb FEATURE: Improve group email settings UI (#13083) 2021-05-28 09:28:18 +10:00
email_settings_validator.rb FEATURE: Improve group email settings UI (#13083) 2021-05-28 09:28:18 +10:00
email_style_updater.rb FEATURE: support SCSS in custom email style 2019-10-23 15:42:37 -04:00
group_action_logger.rb FEATURE - Moderators can create and manage groups (#10432) 2020-08-19 10:41:40 -04:00
group_mentions_updater.rb FIX: Mentions updater should work regardless of .notify 2020-02-18 16:02:26 -05:00
group_message.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
handle_chunk_upload.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
heat_settings_updater.rb FIX: round the calculated heat values 2019-06-06 15:44:55 -04:00
inline_uploads.rb FIX: Skip upload if HTML cannot be parsed (#12971) 2021-05-14 16:52:40 +03:00
notification_consolidator.rb DEV: handle all notification consolidations in new 'NotificationConsolidator' class. 2019-12-05 14:36:06 +05:30
notification_emailer.rb FEATURE: Send an email notification when a post is approved. (#12665) 2021-04-12 12:08:23 -03:00
post_action_notifier.rb FEATURE: Category setting to allow unlimited first post edits by the owner of the topic (#12690) 2021-04-14 15:54:09 +10:00
post_alerter.rb FEATURE: Use group SMTP settings for sending user notification emails (initial) (#13220) 2021-06-03 14:47:32 +10:00
post_owner_changer.rb FIX: Unlike own posts on ownership transfer (#10446) 2020-08-19 09:21:02 -06:00
push_notification_pusher.rb FIX: automatically expire bad push channels (#13156) 2021-05-27 06:49:20 +10:00
random_topic_selector.rb FIX: Use Discourse.system_user when we need a placeholder admin (#9781) 2020-06-24 15:51:30 +10:00
search_indexer.rb DEV: Correct typos and spelling mistakes (#12812) 2021-05-21 11:43:47 +10:00
site_settings_task.rb FEATURE: Treat site settings as plain text and add a new HTML type. (#12618) 2021-04-07 12:51:19 -03:00
staff_action_logger.rb DEV: Upgrade Rails to 6.1.3.1 (#12688) 2021-04-21 12:36:32 +03:00
themes_install_task.rb DEV: Add an option to skip a theme update from the themes:install task. (#12905) 2021-04-30 09:31:41 -07:00
topic_status_updater.rb FIX: Auto close topic from category settings based on topic created_at (#12082) 2021-02-17 07:51:39 +10:00
topic_timestamp_changer.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
tracked_topics_updater.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
trust_level_granter.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
user_action_manager.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
user_activator.rb FEATURE: Allow using invites when DiscourseConnect SSO is enabled (#12419) 2021-03-19 10:20:10 +10:00
user_anonymizer.rb FIX: Destroy associated user api keys when making a user anonymous. (#11760) 2021-01-25 11:07:22 -03:00
user_authenticator.rb FEATURE: Allow invites redemption with Omniauth providers. 2021-03-09 09:27:18 +08:00
user_destroyer.rb FIX: remove invite based associated object (#12927) 2021-05-03 12:49:53 -04:00
user_merger.rb FEATURE: Treat site settings as plain text and add a new HTML type. (#12618) 2021-04-07 12:51:19 -03:00
user_notification_renderer.rb DEV: Upgrade Rails to 6.1.3.1 (#12688) 2021-04-21 12:36:32 +03:00
user_notification_schedule_processor.rb FEATURE: Create notification schedule to automatically set do not disturb time (#11665) 2021-01-20 10:31:52 -06:00
user_silencer.rb FIX: Skip sending PM email for user silence (#12240) 2021-03-02 09:18:09 +10:00
user_updater.rb FEATURE: Rename 'Discourse SSO' to DiscourseConnect (#11978) 2021-02-08 10:04:33 +00:00
username_changer.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
username_checker_service.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
wildcard_domain_checker.rb SECURITY: vulnerability in WildcardUrlChecker 2019-12-13 09:29:09 -05:00
wildcard_url_checker.rb FIX: Allow any protocol in wildcard url checker (#8651) 2020-01-02 16:03:13 +00:00
word_watcher.rb FEATURE: Censor Oneboxes (#12902) 2021-06-03 11:39:12 +10:00