To change the port number, you will need to chane the
http://schemas.microsoft.com/cdo/configuration/smtpserverport field.
The following code snippet demonstrates this technique.
[ C# ]
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "your port number");
SmtpMail.SmtpServer = "mail.mycompany.com";
SmtpMail.Send(mail);
[ VB.NET ]
Dim mail As New MailMessage()
mail.To = "me@mycompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.Body = "Some text goes here"
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "your port number") 'Put port number here
SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
SmtpMail.Send(mail)