[Mono-bugs] [Bug 340501] New: Problem with specifying a custom port for SmtpSend

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Nov 9 07:22:14 EST 2007


           Summary: Problem with specifying a custom port for SmtpSend
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: informatique.internet at fiducial.fr
         QAContact: mono-bugs at ximian.com
          Found By: ---

In MS.NET 1.1 the way to specify a custom port (other than 25) for SmtpSend is
to add a field to the message like this :


(for port 8000)

This test case works well in MS.NET :
Console.WriteLine("envoie "+i);
                                MailMessage message=new MailMessage();
                                message.From="bidon at fidudev.fr";
                                message.To="bidon at fidudev.fr";

In MS.NET it works well, in mono (svn) it fails with : 
Unhandled Exception: System.Web.HttpException: Connection refused --->
System.Net.Sockets.SocketException: Connection refused

So it seems that mono tries to connect to the 25 port.

All the code is in mono to handle this, but there's a little mistake... The
TCPConnection is etablished before setting the port...

Here's the patch that correct the problem :

Index: class/System.Web/System.Web.Mail/SmtpClient.cs
--- class/System.Web/System.Web.Mail/SmtpClient.cs      (révision 89301)
+++ class/System.Web/System.Web.Mail/SmtpClient.cs      (copie de travail)
@@ -54,7 +54,6 @@
        public SmtpClient( string server ) {

            this.server = server;
-           Connect();

        // make the actual connection
@@ -117,7 +116,7 @@
        private void StartSend(MailMessageWrapper msg)
+               Connect();
                // read the server greeting
                smtp.CheckForStatusCode( 220 );

Please commit and backport to 1.2.6...


Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list