// // IMailTransport.cs // // Author: Jeffrey Stedfast // // Copyright (c) 2013-2020 .NET Foundation and Contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using MimeKit; namespace MailKit { /// /// An interface for sending messages. /// /// /// An interface for sending messages. /// public interface IMailTransport : IMailService { /// /// Send the specified message. /// /// /// Sends the specified message. /// The sender address is determined by checking the following /// message headers (in order of precedence): Resent-Sender, /// Resent-From, Sender, and From. /// If either the Resent-Sender or Resent-From addresses are present, /// the recipients are collected from the Resent-To, Resent-Cc, and /// Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used. /// /// The message. /// The cancellation token. /// The progress reporting mechanism. void Send (MimeMessage message, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously send the specified message. /// /// /// Asynchronously sends the specified message. /// The sender address is determined by checking the following /// message headers (in order of precedence): Resent-Sender, /// Resent-From, Sender, and From. /// If either the Resent-Sender or Resent-From addresses are present, /// the recipients are collected from the Resent-To, Resent-Cc, and /// Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used. /// /// An asynchronous task context. /// The message. /// The cancellation token. /// The progress reporting mechanism. Task SendAsync (MimeMessage message, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Send the specified message using the supplied sender and recipients. /// /// /// Sends the specified message using the supplied sender and recipients. /// /// The message. /// The mailbox address to use for sending the message. /// The mailbox addresses that should receive the message. /// The cancellation token. /// The progress reporting mechanism. void Send (MimeMessage message, MailboxAddress sender, IEnumerable recipients, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously send the specified message using the supplied sender and recipients. /// /// /// Asynchronously sends the specified message using the supplied sender and recipients. /// /// An asynchronous task context. /// The message. /// The mailbox address to use for sending the message. /// The mailbox addresses that should receive the message. /// The cancellation token. /// The progress reporting mechanism. Task SendAsync (MimeMessage message, MailboxAddress sender, IEnumerable recipients, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Send the specified message. /// /// /// Sends the specified message. /// The sender address is determined by checking the following /// message headers (in order of precedence): Resent-Sender, /// Resent-From, Sender, and From. /// If either the Resent-Sender or Resent-From addresses are present, /// the recipients are collected from the Resent-To, Resent-Cc, and /// Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used. /// /// The formatting options. /// The message. /// The cancellation token. /// The progress reporting mechanism. void Send (FormatOptions options, MimeMessage message, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously send the specified message. /// /// /// Asynchronously sends the specified message. /// The sender address is determined by checking the following /// message headers (in order of precedence): Resent-Sender, /// Resent-From, Sender, and From. /// If either the Resent-Sender or Resent-From addresses are present, /// the recipients are collected from the Resent-To, Resent-Cc, and /// Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used. /// /// An asynchronous task context. /// The formatting options. /// The message. /// The cancellation token. /// The progress reporting mechanism. Task SendAsync (FormatOptions options, MimeMessage message, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Send the specified message using the supplied sender and recipients. /// /// /// Sends the specified message using the supplied sender and recipients. /// /// The formatting options. /// The message. /// The mailbox address to use for sending the message. /// The mailbox addresses that should receive the message. /// The cancellation token. /// The progress reporting mechanism. void Send (FormatOptions options, MimeMessage message, MailboxAddress sender, IEnumerable recipients, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously send the specified message using the supplied sender and recipients. /// /// /// Asynchronously sends the specified message using the supplied sender and recipients. /// /// An asynchronous task context. /// The formatting options. /// The message. /// The mailbox address to use for sending the message. /// The mailbox addresses that should receive the message. /// The cancellation token. /// The progress reporting mechanism. Task SendAsync (FormatOptions options, MimeMessage message, MailboxAddress sender, IEnumerable recipients, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Occurs when a message is successfully sent via the transport. /// /// /// The event will be emitted each time a message is successfully sent. /// event EventHandler MessageSent; } }