[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
https://bugzilla.novell.com/show_bug.cgi?id=340501
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 :
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",8000);
(for port 8000)
This test case works well in MS.NET :
Console.WriteLine("envoie "+i);
MailMessage message=new MailMessage();
message.Subject="Essai";
message.From="bidon at fidudev.fr";
message.To="bidon at fidudev.fr";
message.Body="essai";
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",8000);
SmtpMail.SmtpServer="10.69.100.164";
SmtpMail.Send(message);
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)
{
ReadFields(msg);
-
+ Connect();
// read the server greeting
smtp.ReadResponse();
smtp.CheckForStatusCode( 220 );
Please commit and backport to 1.2.6...
Thanks
--
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