[Mono-bugs] [Bug 626164] New: System.Net.Mail.SmtpClient sometimes silently drops messages on the floor

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 27 21:26:41 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=626164

http://bugzilla.novell.com/show_bug.cgi?id=626164#c0


           Summary: System.Net.Mail.SmtpClient sometimes silently drops
                    messages on the floor
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: jbevain at novell.com
        ReportedBy: n5jrn at mac.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us)
AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16

I've been trying to figure out why a comments page I'm trying to develop
in ASP.NET under Mono sometimes does not e-mail me the user's comment
when the send button is clicked.

After spending many hours trying to pinpoint the problem, it appears to
be in the Mono class library. System.Net.Mail.SmtpClient for some reason
sometimes drops messages on the floor. This seems to be related to the
contents of the MailMessage object being sent; in particular, if I play
around with the Subject property, I can make a message that won't get
sent get sent (and vice versa).

Needless to say, very strange. The code below lists one subject that
works and one that does not. It's obviously not simply related to the
length of the subject (both short and long subjects work and don't work,
and the example subject that works is longer than the one that doesn't).

When the problem manifests itself, the Send method returns, apparently
successfully, but nothing ever gets sent and no exception gets thrown.

The following test case always makes the problem manifest itself for me.
(Note that I've X'ed out my SMTP password for obvious reasons.) It
silently fails to send any message on Mono under both Linux and OSX, yet
when the exact same .EXE file is run under Microsoft.NET on Windows it
does send a message.

It doesn't seem to make any difference whether the .EXE is generated
from gmcs on OSX or csc on Windows. The .EXE file runs on Microsoft.NET
and silently fails to send a message on Mono regardless of whose
compiler I use.

I've noticed the bug in both Mono 2.6.4 and Mono 2.6.3.

---------- begin test case ----------

using System;
using System.Text;
using System.Net;
using System.Net.Mail;

class TestMail
{
    private const string host = "smtp.me.com";

    public static void Main(string[] args)
    {
        string from = "n5jrn at me.com";
        string to = "n5jrn at me.com";

        // Mail will not get sent with this subject
        string subject = "Comment on entry for Thu May 06 08:22:09 PDT 2010";
        // ... but will get sent with this one!
        // string subject = "Testing test test test test test test test test
test test";
        string message = "This is a test.\r\n";

        // Create message object
        MailMessage msg = new MailMessage(from, to);
        msg.Subject = subject;
        msg.Body = message;

        // Send it
        SmtpClient smtp = new SmtpClient();
        NetworkCredential cred = new NetworkCredential();
        cred.UserName = "n5jrn";
        cred.Password = "xxxxxxxx";
        smtp.Credentials = cred;
        smtp.Host = host;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.EnableSsl = false;
        smtp.Timeout = 100000;
        smtp.UseDefaultCredentials = false;
        smtp.Port = 25;
        smtp.Send(msg);
    }
}


Reproducible: Always

Steps to Reproduce:
Compile the test case and run it (you'll probably have to plug in suitable
values for your own mail server). No special linking instructions are needed.
Actual Results:  
No mail message ever gets sent.

Expected Results:  
A mail message should have been sent.

-- 
Configure bugmail: http://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