Specify different port for POP3, SMTP or IMAP

Establishing IMAP, POP3 or SMTP connection with Mail.dll email component using a default port is easy:

// C#

client.Connect("mail.example.com");

' VB.NET

client.Connect("mail.example.com")

If you need to specify different port just use overloaded version of Connect method:

// C#

client.Connect("mail.example.com", 999);
// -or-
client.Connect("mail.example.com", 999, false);

' VB.NET

client.Connect("mail.example.com", 999)
' -or-
client.Connect("mail.example.com", 999, False)

If you are using SSL/TLS:

// C#

client.ConnectSSL("mail.example.com", 999);
// -or-
client.Connect("mail.example.com", 999, true);

' VB.NET

client.ConnectSSL("mail.example.com", 999)
' -or-
client.Connect("mail.example.com", 999, True)

Check out the difference between implicit and explicit SSL/TLS modes.

Tags:     

Questions?

Consider using our Q&A forum for asking questions.