[Mono-bugs] [Bug 670475] New: System.Net.Mail.MailAddress generates empty name for recipient if only email specified

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 8 19:25:22 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=670475

https://bugzilla.novell.com/show_bug.cgi?id=670475#c0


           Summary: System.Net.Mail.MailAddress generates empty name for
                    recipient if only email specified
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: novell at public.nv-systems.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13)
Gecko/20101203 Firefox/3.6.13

When sending mail using System.Net.Mail.SmtpClient() using the following
(relevant) lines of code, not the same email headers are generated when sending
the emails using .NET/Mono.

While sending does work, the result obtained when running the code in
Windows/.NET is much nicer.

Code Example:
System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage();
mailMessage.From = sender;
mailMessage.To.Add(new System.Net.Mail.MailAddress("myemail at mydomain.net"))

When creating a MailAddress with only an email specified (it's possible but not
required to also specify a name by providing additional parameters), the name
is set to "" in the header when using Mono, while no name is specified when
using .NET.

For the recipient of the mail, the mail sent to the empty name may look weird,
depending on the mail client. A good example where it looks bad is the mail
client in iOS.

=> When no name is specified while creating a MailAddress, please don't put an
empty "" name field in the header of the mail.


Reproducible: Always

Steps to Reproduce:
1. Use the code specified to send a mail to someone, specifying only a
recipient email address and no name
2. Compare the resulting mail header from code running in Mono and .NET
3. Observe that the mail header generated by .NET looks better

Actual Results:  
Message source (header) of the mail that has been sent using Linux/Mono:

To: "" <myemail at mydomain.net>


Expected Results:  
Message source (header) of the mail that has been sent using Windows/.NET:

To: myemail at mydomain.net

- both the mail generated on the windows machine and the mail generated on the
linux machine were sent through the same SMTP server
- tested using Mono 2.8.2 on Gentoo x64

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


More information about the mono-bugs mailing list