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

Need more email servers for INotificationMethodProvider #17298

Open
canadacubachina opened this issue Jan 3, 2025 · 6 comments
Open

Need more email servers for INotificationMethodProvider #17298

canadacubachina opened this issue Jan 3, 2025 · 6 comments

Comments

@canadacubachina
Copy link

Is your feature request related to a problem?

Describe the solution you'd like

inside, INotificationMethodProvider , we can add more email services to send the email, if first one get success, break it. in this way, we can guarantee the success of sending the email and the user can choose their preferred email server.

Describe alternatives you've considered

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Thank you for submitting your first issue, awesome! 🚀 We're thrilled to receive your input. If you haven't completed the template yet, please take a moment to do so. This ensures that we fully understand your feature request or bug report. On what happens next, see the docs.

If you like Orchard Core, please star our repo and join our community channels.

@Piedone
Copy link
Member

Piedone commented Jan 3, 2025

The EmailNotificationProvider can send e-mail notifications with IEmailService, which in turn will use the currently configured way of sending e-mails. This can be any of the built-in features (SMTP, local folder, Azure Communication Services), with configuration provided from the admin or from appsettings/the environment, or you can implement your own.

Can you please explain what's the exact scenario this doesn't cover? Why do you want to attempt to send e-mails via multiple alternative services? What is the problem you're trying to solve?

@hishamco hishamco changed the title Need more emal servers for INotificationMethodProvider Need more email servers for INotificationMethodProvider Jan 4, 2025
@canadacubachina
Copy link
Author

i want to send the email by gmail first which is free, if it failed , Azure Communication Services, if failed , other paid service, reasonable?

@Piedone
Copy link
Member

Piedone commented Jan 5, 2025

It's certainly a unique ask. However, it's something you can implement with some coding. Take a look at how this pipeline works by starting from here:

public async Task<EmailResult> SendAsync(MailMessage message, string name = null)

And here you can see that it's possible to loop through the registered providers:

if (_providerOptions.Providers.TryGetValue(name, out var providerType))

Based on this, you can implement a new IEmailService, and within it, resolve multiple IEmailProviders to achieve what you're looking for.

That being said, I'd rather recommend you use a reliable e-mail service.

@canadacubachina
Copy link
Author

thanks for the suggestion. another similar question about SMS, HOW can we deal with that?

@Piedone
Copy link
Member

Piedone commented Jan 6, 2025

It's the same pattern. Check out SmsService and DefaultSmsProviderResolver.

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

No branches or pull requests

2 participants