namespace ZB.MOM.WW.ScadaBridge.NotificationService; /// /// Abstraction over SMTP client for testability. /// public interface ISmtpClientWrapper { /// /// Connects to the SMTP server. /// /// /// NS-005: explicit three-state TLS mode (None/StartTls/Ssl) — replaces the old /// bool useTls which could not represent implicit-SSL and silently fell /// back to opportunistic negotiation for non-StartTLS configurations. /// /// /// NS-007: SMTP connection/operation timeout in seconds. A non-positive value /// leaves the client's default timeout in place. /// /// SMTP server hostname or IP address. /// SMTP server port. /// Cancellation token. /// A task that represents the asynchronous operation. Task ConnectAsync( string host, int port, SmtpTlsMode tlsMode, int connectionTimeoutSeconds, CancellationToken cancellationToken = default); /// Authenticates to the SMTP server using the specified auth type and credentials. /// Authentication mechanism (e.g. PLAIN, XOAUTH2). /// Credential string appropriate for the auth type, or null. /// /// NS-021: mailbox identity the OAuth2 access token was issued for (typically /// the SMTP FromAddress). Used as the user= field of the XOAUTH2 /// SASL initial response — M365 rejects an empty/mismatched user with /// 535 5.7.3. Ignored for non-OAuth2 auth types; default null for /// callers that do not authenticate with OAuth2. /// /// Cancellation token. /// A task that represents the asynchronous operation. Task AuthenticateAsync( string authType, string? credentials, string? oauth2UserName = null, CancellationToken cancellationToken = default); /// Sends an email message with the specified recipients via BCC. /// Sender address. /// Recipients delivered as BCC. /// Email subject line. /// Plain-text email body. /// Cancellation token. /// A task that represents the asynchronous operation. Task SendAsync(string from, IEnumerable bccRecipients, string subject, string body, CancellationToken cancellationToken = default); /// Disconnects from the SMTP server gracefully. /// Cancellation token. /// A task that represents the asynchronous operation. Task DisconnectAsync(CancellationToken cancellationToken = default); }