<<Back To Faq 2.9


Complete FAQ Listing


2.9 How do I change the port number? Printer Friendly   Email This FAQ   Discuss

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)

 



The formatted version of this faq can be found at http://www.SystemWebMail.com/faq/2.9.aspx