-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Azure Email Communication Services (Lombiq Technologies: OCORE-129) #15254
Conversation
Refactored the Email service to use EmailProviders
…to keep it all backward compatible.
This pull request has merge conflicts. Please resolve those before requesting a review. |
I'm sure it's awesome, and I appreciate the effort, really, but after spending days reviewing #14749 and finally being OK with it, I don't think I have it in me to do it once again anytime soon. Especially that it seems that this is something from scratch, as opposed to starting from that branch. I'd emphasize here too that this feature would be only usable for us if it doesn't need UI configuration, but everything can come from configuration providers. I'm not sure if that's the case. |
I understand. However, I would not have spent the time to re-implement that PR if I did it's not worth it. At the end of the day, we want to keep the code in the framework clean and extensible. I highlighted the advantages on this PR so that way we can compare the advantage/disadvantage of each approach and bring into main the better one. Even if you don't want to review the code, I would review the argument regardless how long that other PR took. (Both provider you what you need which is ACS so it's a win) I you can to spend 10 mins on this PR, please read the docs included in the PR to understand some of the changes. Also, if you can, check out the branch and test out the ACS provider and make sure you can quickly perform a test. You can use the test UI to ensure that the service is working. Also, don't forget that the code in the other PR has breaking changes and is not extensible as this one provides.
There is an option to |
I'll get back to you in the next days. |
Are you saying that we should enable the SMTP provider by default? But, what if it is not configured? The Additionally,
I am not sure what you are referring to here. When there are no appsettings provided, the user is able to configure the provider from UI.
I think false as default is better.
If the checkbox is not checked, it should not be enabled. Maybe it's a bug. I'll look. The idea of providers is that you don't need to depend on features. Also, what if you enable a feature but never configure the provider? You must configure a provider before you use it. Enabling a feature is not enough to get a provider to work unless you configure it. That's the nature of providers.
Yes if you enable the SMTP provider, you need to configure it properly. There is another issue open to highlight the tabs when a tab contain an error. That is something we can address in a separate PR which is related on how currently tabs behave.
I'll look
I'll look. You should see this error "The selected provider is invalid or no longer enabled." I'll update you once I address the bugs you mentioned. |
Maybe I come late, just a quick thing why I SHOULD enable the provider if the feature already enable? I presume enabling the feature indicates that it should works without any further settings |
@BenedekFarkas I addressed most if not all your feedback. Please try it out again. Now, if the provider is configured previously (like SMTP settings already exists), we'll auto enable the the provider. The same goes to configuration provided by the appsettings/environment variables. If you pre-configure a provider from file, we'll auto enable the provider. Can you confirm that you are able to test the Azure email provider again using the test UI to make sure it sends messages as we are expecting?
@hishamco in the case of Azure Email, if you provide settings in the appsettings, then enabling the feature will auto enable the provider for you. But, if you enable the feature without any configuration, then you'll need to enable the provider by configuring it using the UI. Without configuration a provider is useless as it'll always fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! @BenedekFarkas @hishamco if you'd like, please review it. I'm unsubscribing from this PR now, so if you want to involve me, please @mention me. Otherwise, I'm good to merge this and needn't be involved anymore.
The thing that still surprised me was how I can enable/disable an email provider after I enable its' feature, this is confusing from the user perspective. I already mentioned that a long time ago, but I'm not sure what you agreed with @Piedone |
I don't have anything else to add on that topic. |
Seems you need to merge only :) but that's a crucial question from the beginning |
@hishamco each feature compose multiple provider. If you provide settings using the configuration provider, you won't need to worry about the UI at all. But, if you want to provider tenant level settings, then you enable the tenant level providers. Think of it as a provider for configuration provider level. and another provider for admin settings. You can have one enabled or both at the same time. |
How, I presume each feature enables certain type of email provider |
@BenedekFarkas any additional feedback? I would like to merge this PR soon unless you have additional requests |
/// <summary> | ||
/// Represents a SMTP service that allows to send emails. | ||
/// </summary> | ||
public class SmtpService : ISmtpService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a binary-breaking change!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only if you are depending on SmtpService
directly. Usually ISmtpService
is injected and used. So if someone in inheriting from SmtpService
directly, they would have a compile time error. So it is okay.
I'll do some final functional testing later today! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, thanks! One minor thing I noticed is related to the default provider - repro steps:
- I have both the SMTP and Azure Email features enabled and their settings set up.
- Select Azure as the default provider.
- Disable the Azure Email feature.
- Email sending (from a workflow) fails.
I believe in this case the provider selection should automatically fall back to SMTP (in generic terms, another enabled provider, if there is one).
BTW if I navigate to the email settings screen, then it looks like that the SMTP provider is selected as default (because there's no other value in the dropdown), but due to the above, it's not actually selected.
@BenedekFarkas good catch. That issue is now fixed. Let me know if you see anything else or if you approve. |
Awesome! Can't wait to start using it for our sites! |
…ies: OCORE-129) (OrchardCMS#15254) --------- Co-authored-by: Hisham Bin Ateya <[email protected]> Co-authored-by: Zoltán Lehóczky <[email protected]> Co-authored-by: Benedek Farkas <[email protected]>
The following some of advantages for using this PR over #14749
The following objects have been marked obsolete. They are kept for backward compatibility.
@hishamco @Piedone @BenedekFarkas
Here is a quick demo of the UI
Fixes #14699.