Click or drag to resize
MimeKit

Pop3ClientExpirePolicy Property

Gets the expiration policy.

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll) Version: 4.3.0
Syntax
C#
public int ExpirePolicy { get; }

Property Value

Int32
The expiration policy.

Implements

IPop3ClientExpirePolicy
Remarks

If the server supports the EXPIRE capability (Expire), the value of the ExpirePolicy property will reflect the value advertized by the server.

A value of -1 indicates that messages will never expire.

A value of 0 indicates that messages that have been retrieved during the current session will be purged immediately after the connection is closed via the QUIT command.

Values larger than 0 indicate the minimum number of days that the server will retain messages which have been retrieved.

Example
C#
public static void PrintCapabilities ()
{
    using (var client = new Pop3Client ()) {
        client.Connect ("pop.gmail.com", 995, SecureSocketOptions.SslOnConnect);

        if (client.Capabilities.HasFlag (Pop3Capabilities.SASL)) {
            var mechanisms = string.Join (", ", client.AuthenticationMechanisms);
            Console.WriteLine ("The POP3 server supports the following SASL mechanisms: {0}", mechanisms);
        }

        client.Authenticate ("username", "password");

        if (client.Capabilities.HasFlag (Pop3Capabilities.Apop))
            Console.WriteLine ("The server supports APOP authentication.");

        if (client.Capabilities.HasFlag (Pop3Capabilities.Expire)) {
            if (client.ExpirePolicy > 0)
                Console.WriteLine ("The POP3 server automatically expires messages after {0} days", client.ExpirePolicy);
            else
                Console.WriteLine ("The POP3 server will never expire messages.");
        }

        if (client.Capabilities.HasFlag (Pop3Capabilities.LoginDelay))
            Console.WriteLine ("The minimum number of seconds between login attempts is {0}.", client.LoginDelay);

        if (client.Capabilities.HasFlag (Pop3Capabilities.Pipelining))
            Console.WriteLine ("The POP3 server can pipeline commands, so using client.GetMessages() will be faster.");

        if (client.Capabilities.HasFlag (Pop3Capabilities.Top))
            Console.WriteLine ("The POP3 server supports the TOP command, so it's possible to download message headers.");

        if (client.Capabilities.HasFlag (Pop3Capabilities.UIDL))
            Console.WriteLine ("The POP3 server supports the UIDL command which means we can track messages by UID.");

        client.Disconnect (true);
    }
}
See Also