-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ma/fix-azure-ai-docs
- Loading branch information
Showing
5 changed files
with
50 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/OrchardCore/OrchardCore.Email.Abstractions/Extensions/EmailServiceExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Email; | ||
|
||
/// <summary> | ||
/// Provides extension methods to <see cref="ISmtpService"/>. | ||
/// </summary> | ||
public static class EmailServiceExtensions | ||
{ | ||
/// <summary> | ||
/// Sends the specified message to an SMTP server for delivery. | ||
/// </summary> | ||
/// <param name="emailService">The <see cref="IEmailService"/>.</param> | ||
/// <param name="to">The email recipients.</param> | ||
/// <param name="subject">The email subject.</param> | ||
/// <param name="body">The email body.</param> | ||
/// <param name="isHtmlBody">Whether the <paramref name="body"/> is in HTML format or not. Defaults to <c>true</c>.</param> | ||
/// <returns></returns> | ||
/// <exception cref="System.ArgumentException"></exception> | ||
public static Task<EmailResult> SendAsync(this IEmailService emailService, string to, string subject, string body, bool isHtmlBody = true) | ||
{ | ||
var message = new MailMessage | ||
{ | ||
To = to, | ||
Subject = subject, | ||
Body = body, | ||
IsHtmlBody = isHtmlBody | ||
}; | ||
|
||
return emailService.SendAsync(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters