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
anonymous_shadow_creator.rb
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
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
group_action_logger.rb
group_mentions_updater.rb
group_message.rb
handle_chunk_upload.rb
heat_settings_updater.rb
inline_uploads.rb FIX: Skip upload if HTML cannot be parsed (#12971) 2021-05-14 16:52:40 +03:00
notification_consolidator.rb
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
push_notification_pusher.rb FIX: automatically expire bad push channels (#13156) 2021-05-27 06:49:20 +10:00
random_topic_selector.rb
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
topic_timestamp_changer.rb
tracked_topics_updater.rb
trust_level_granter.rb
user_action_manager.rb
user_activator.rb FEATURE: Allow using invites when DiscourseConnect SSO is enabled (#12419) 2021-03-19 10:20:10 +10:00
user_anonymizer.rb
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
user_silencer.rb FIX: Skip sending PM email for user silence (#12240) 2021-03-02 09:18:09 +10:00
user_updater.rb
username_changer.rb
username_checker_service.rb
wildcard_domain_checker.rb
wildcard_url_checker.rb
word_watcher.rb FEATURE: Censor Oneboxes (#12902) 2021-06-03 11:39:12 +10:00