MailBee.NET Objects 4.0

Pop3.SslMode Property

Gets or sets how the component should establish TLS/SSL connection with the mail server.

public MailBee.Security.SslStartupMode SslMode {get; set;}

Property Value

One of SslStartupMode values specifying if and how the component should establish TLS/SSL connection with the mail server. The default value is Manual which means the connection won't be established in TLS/SSL mode unless the developer manually calls StartTls method.

Remarks

Note   Not all mail servers support TLS/SSL functionality. Also, some servers support only TLS or only SSL (see SslProtocol topic for details).

Example

This sample connects to the mail server on regular port 110, then switches the connection into TLS/SSL mode using STLS command, logs in the mail account and downloads the first mail message in this account.

[C#]
// To use the code below, import MailBee namespaces at the top of your code
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Security;
using MailBee.Mime;

// The actual code (put it into a method of your class).
Pop3 pop = new Pop3();
pop.SslMode = SslStartupMode.UseStartTls;
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret");
if (pop.InboxMessageCount > 0)
{
    MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount);
    Console.WriteLine(msg.Attachments.Count + " attachment(s) in the message.");
}
pop.Disconnect();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code
Imports MailBee
Imports MailBee.Pop3Mail
Imports MailBee.Security
Imports MailBee.Mime

' The actual code (put it into a method of your class).
Dim pop As New Pop3
pop.SslMode = SslStartupMode.UseStartTls
pop.Connect("mail.domain.com")
pop.Login("jdoe", "secret")
If pop.InboxMessageCount > 0 Then
    MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount);
    Console.WriteLine(msg.Attachments.Count & " attachment(s) in the message.");
End If
pop.Disconnect();

See Also

Pop3 Class | MailBee.Pop3Mail Namespace | SslProtocol | StartTls