MimeKit.MimeMessage.Accept C# (CSharp) Method

Accept() public method

Dispatches to the specific visit method for this MIME message.
This default implementation for MimeKit.MimeMessage nodes calls MimeKit.MimeVisitor.VisitMimeMessage. Override this method to call into a more specific method on a derived visitor class of the MimeKit.MimeVisitor class. However, it should still support unknown visitors by calling MimeKit.MimeVisitor.VisitMimeMessage.
/// is null. ///
public Accept ( MimeKit.MimeVisitor visitor ) : void
visitor MimeKit.MimeVisitor The visitor.
return void
		public virtual void Accept (MimeVisitor visitor)
		{
			if (visitor == null)
				throw new ArgumentNullException (nameof (visitor));

			visitor.VisitMimeMessage (this);
		}

Usage Example

        /// <summary>
        /// detects whether a message is a standard bounce message.
        /// </summary>
        ///
        /// essentially this finds the `multipart/report; report-type=delivery-status` part and
        /// its `message/delivery-status` sub-part to decide whether a message is a bounce.
        ///
        /// the message/delivery-status mime part looks something like:
        ///
        ///      Content-Type: message/delivery-status
        ///
        ///      Reporting-MTA: dns; PTPEDGE02.test.local
        ///
        ///      Final-recipient: RFC822;
        ///       [email protected]
        ///      Action: failed
        ///      Status: 5.1.1
        ///      Remote-MTA: dns; mx.google.com
        ///      X-Supplementary-Info: &lt;mx.google.com #5.1.1 smtp;550-5.1.1 The email account
        ///       that you tried to reach does not exist.Please try 550-5.1.1 double-checking
        ///      the recipient's email address for typos or 550-5.1.1 unnecessary spaces.
        ///       Learn more at 550 5.1.1  https://support.google.com/mail/answer/6596
        ///       om11si19081667wic.29 - gsmtp>
        ///
        /// See the multipart/report format RFC:
        ///      The Multipart/Report Media Type for the Reporting of Mail System Administrative Messages
        ///      https://tools.ietf.org/html/rfc6522
        /// See the message/delivery-status RFC:
        ///      An Extensible Message Format for Delivery Status Notifications
        ///      https://tools.ietf.org/html/rfc3464
        public static BounceDetectResult Detect(MimeMessage message)
        {
            var visitor = new Visitor();

            message.Accept(visitor);

            var result = visitor.Result;

            return new BounceDetectResult(
                message,
                result.DeliveryNotificationPart,
                result.DeliveryStatus,
                result.UndeliveredMessagePart
            );
        }
All Usage Examples Of MimeKit.MimeMessage::Accept