MailBee.NET Objects 4.0

Imap.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 dedicated IMAP4 SSL port 993, logs in the mail account and displays the list of all folders in this account.

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

// The actual code (put it into a method of your class).
Imap imp = new Imap();
imp.SslMode = SslStartupMode.OnConnect;
imp.Connect("mail.domain.com", 993);
imp.Login("jdoe", "secret");
FolderCollection folders = imp.DownloadFolders();
foreach (Folder imapFolder in folders)
{
    Console.WriteLine(imapFolder.Name);
}
imp.Disconnect();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.ImapMail
Imports MailBee.Security

' The actual code (put it into a method of your class).
Dim imp As New Imap
imp.SslMode = SslStartupMode.OnConnect
imp.Connect("mail.domain.com", 993)
imp.Login("jdoe", "secret")
Dim folders As FolderCollection = imp.DownloadFolders()
For Each imapFolder As Folder In folders
    Console.WriteLine(imapFolder.Name)
Next
imp.Disconnect()

See Also

Imap Class | MailBee.ImapMail Namespace | SslProtocol | StartTls