none
Customize SMTP Port ? RRS feed

  • Question

  • Hello, i'm new here. I have just learned about IMAP, POP and SMTP for sending mail through Outlook. I have the following problem:

    The specific instructions for these issues assign a certain port number to the servers, for example, for SMTP, the default Port is 587. Is there any way to replace it? Change this port number or not? Because I want to be able to customize a certain port for all servers to make it easy to remember. I have the following code:

    using ComponentPro.Net;
    using ComponentPro.Net.Mail;
    
    ...
    
    // Create a new instance of the Smtp class.
    using (var client = new Smtp())
    {
    	// Connect to the server.
    	client.Connect("outlook.office365.com", 587, SslSecurityMode.Explicit);
    
    	// Login to the server.
    	client.Authenticate("user", "password");
    
    	// Create a new mail message.
    	MailMessage msg = new MailMessage();
    	msg.Subject = "Test Subject";
    	msg.BodyText = "Content";
    	msg.From = "from@mydomain.com";
    	msg.To = "to@somedomain.com";
    
    	// And send it.
    	client.Send(msg);
    }
    // The connection is automatically closed here.
    // This code belongs to Ultimate Component for .NET.

    This is an example that I took from here. As you can see, the default port here is 587. Therefore, changing the port for SMTP is necessary for me. Any offer will be appreciated. Thank you.

    Monday, July 22, 2019 12:47 AM

Answers

All replies