mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
add xmldoc comments
This commit is contained in:
@@ -18,6 +18,25 @@ public class SmtpEmailProvider : IEmailProvider
|
||||
private readonly string _fromEmail;
|
||||
private readonly string _fromName;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="SmtpEmailProvider"/>, reading SMTP configuration
|
||||
/// from environment variables.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Reads the following environment variables:
|
||||
/// <list type="bullet">
|
||||
/// <item><description><c>SMTP_HOST</c> (required) - the SMTP server hostname.</description></item>
|
||||
/// <item><description><c>SMTP_PORT</c> (optional, default "587") - the SMTP server port, must be a valid integer.</description></item>
|
||||
/// <item><description><c>SMTP_USERNAME</c> (optional) - the username used for authentication.</description></item>
|
||||
/// <item><description><c>SMTP_PASSWORD</c> (optional) - the password used for authentication.</description></item>
|
||||
/// <item><description><c>SMTP_USE_SSL</c> (optional, default "true") - whether to use StartTls when connecting.</description></item>
|
||||
/// <item><description><c>SMTP_FROM_EMAIL</c> (required) - the email address used as the sender.</description></item>
|
||||
/// <item><description><c>SMTP_FROM_NAME</c> (optional, default "The Biergarten") - the display name used as the sender.</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown when <c>SMTP_HOST</c> or <c>SMTP_FROM_EMAIL</c> is not set, or when <c>SMTP_PORT</c> is not a valid integer.
|
||||
/// </exception>
|
||||
public SmtpEmailProvider()
|
||||
{
|
||||
_host =
|
||||
@@ -53,6 +72,14 @@ public class SmtpEmailProvider : IEmailProvider
|
||||
?? "The Biergarten";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends an email to a single recipient by delegating to the multi-recipient overload.
|
||||
/// </summary>
|
||||
/// <param name="to">Recipient email address</param>
|
||||
/// <param name="subject">Email subject line</param>
|
||||
/// <param name="body">Email body (HTML or plain text)</param>
|
||||
/// <param name="isHtml">Whether the body is HTML (default: true)</param>
|
||||
/// <exception cref="InvalidOperationException">Thrown when connecting, authenticating, or sending via SMTP fails.</exception>
|
||||
public async Task SendAsync(
|
||||
string to,
|
||||
string subject,
|
||||
@@ -63,6 +90,16 @@ public class SmtpEmailProvider : IEmailProvider
|
||||
await SendAsync([to], subject, body, isHtml);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends an email to multiple recipients using MailKit's <see cref="SmtpClient"/>.
|
||||
/// Connects using StartTls when SSL is enabled (or no encryption otherwise), authenticates
|
||||
/// if credentials were configured, sends the message, and disconnects.
|
||||
/// </summary>
|
||||
/// <param name="to">List of recipient email addresses</param>
|
||||
/// <param name="subject">Email subject line</param>
|
||||
/// <param name="body">Email body (HTML or plain text)</param>
|
||||
/// <param name="isHtml">Whether the body is HTML (default: true)</param>
|
||||
/// <exception cref="InvalidOperationException">Thrown when connecting, authenticating, or sending via SMTP fails. The original exception is included as the inner exception.</exception>
|
||||
public async Task SendAsync(
|
||||
IEnumerable<string> to,
|
||||
string subject,
|
||||
|
||||
Reference in New Issue
Block a user