Specify different port for POP3, SMTP or IMAP

Establishing connection using 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:

// 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)

Tags: , , , ,

Questions?

Consider using our Q&A forum for asking any questions.