MailBee.NET Objects 4.0

SmtpServer.SslMode Property

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

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 submits a mail message to the SMTP server through the secure TLS/SSL connection. The connection is made to the regular SMTP port 25, and STARTTLS command is sent to switch the connection into TLS/SSL mode.

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

// The actual code (put it into a method of your class).
Smtp mailer = new Smtp();
SmtpServer server = new SmtpServer("mail.domain.com", "jdoe", "secret");
server.SslMode = SslStartupMode.UseStartTls;
mailer.SmtpServers.Add(server);
mailer.From.Email = "jdoe@domain.com";
mailer.To.Add("kathy@company.com");
mailer.Subject = "Report";
mailer.BodyPlainText = "The report contents";
mailer.Send();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.SmtpMail
Imports MailBee.Security

' The actual code (put it into a method of your class).
Dim mailer As New Smtp
Dim server As SmtpServer = New SmtpServer("mail.domain.com", "jdoe", "secret")
server.SslMode = SslStartupMode.UseStartTls
mailer.SmtpServers.Add(server)
mailer.From.Email = "jdoe@domain.com"
mailer.To.Add("kathy@company.com")
mailer.Subject = "Report"
mailer.BodyPlainText = "The report contents"
mailer.Send()

See Also

SmtpServer Class | MailBee.SmtpMail Namespace | SslMode | SslProtocol