[Mono-bugs] [Bug 607424] New: sending mail with alternateview multiple times, results in empty emails

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 20 04:00:16 EDT 2010


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

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


           Summary: sending mail with alternateview multiple times,
                    results in empty emails
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i686
        OS/Version: Ubuntu
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: peter at wingsofdeath.nu
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4
(KHTML, like Gecko) Chrome/5.0.375.38 Safari/533.4

When trying to send multiple emails with an AlternateView (html in this case),
only the first email has a body, the others will be empty. On debugging, the
mail message still contains the alternate view. Tested this against .net
(Visual Studio 2010 express) and it sends all the messages with content. This
bug is also reproducible on Mono 2.6.4. 

using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mime;
using System.Net.Mail;

namespace EmailTesting
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] addresses = new string[] { "peter at djm.nl",
"peter at wingsofdeath.nu" };

            SmtpClient smtp = new SmtpClient("192.168.0.9");
            MailMessage mail = new MailMessage();
            mail.Subject = "testing";
            mail.From = new MailAddress("peter at djm.nl");

            AlternateView htmlView =
AlternateView.CreateAlternateViewFromString("<html><body><b>test</b></body></html>",
System.Text.Encoding.UTF8, "text/html");
            mail.AlternateViews.Add(htmlView);

            // step through collection, and send for every record an email
            foreach (string address in addresses)
            {
                mail.To.Clear();
                mail.To.Add(new MailAddress(address));

                if (mail.To != null && mail.To.Count > 0)
                {
                    smtp.Send(mail);
                }
            }
        }
    }
}

Tested by setting the html directly in the body, without an alternateview is
working ok.

Reproducible: Always

Steps to Reproduce:
Just run this example code, builded with MonoDevelop 2.2.1
Actual Results:  
The first email contains the html, while the second one is empty

Expected Results:  
All send emails should be equal

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