I'm using System.Web.Mail to send an email message from an ASP.NET web
page.
This is the main section of the code.
//************* start code *****************************
string[] mailHost =
(System.Configuration.ConfigurationSettings.AppSet tings.GetValues("mailserver"));
//Get data from page
string toAddress =
((tbTo.Text==null)||(tbTo.Text.Equals(String.Empty )))?String.Empty:tbTo.Text.Trim();
string ccAddress =
((tbCC.Text==null)||(tbCC.Text.Equals(String.Empty )))?String.Empty:tbCC.Text.Trim();
string subjectLine =
((tbSubject.Text==null)||(tbSubject.Text.Equals(St ring.Empty)))?String.Empty:tbSubject.Text.Trim();
string messageText =
((tbMessage.Text==null)||(tbMessage.Text.Equals(St ring.Empty)))?String.Empty:tbMessage.Text.Trim();
//Set message parameters
MailMessage MyMail = new MailMessage();
MyMail.From =
(System.Configuration.ConfigurationSettings.AppSet tings.GetValues("fromaddress"))[0];
MyMail.To = toAddress;
MyMail.Cc = ccAddress;
MyMail.Subject = subjectLine;
MyMail.BodyFormat = MailFormat.Text;
MyMail.Body = messageText;
SmtpMail.SmtpServer = mailHost;
//send email
SmtpMail.Send(MyMail);
//************* end code *****************************
This code works perfectly when I send email to 5-10 users. However,
when I select a larger group of people the email gets jumbled up. It
puts all the "TO" addresses in the body of the message and also some
extraneous email header info (scroll down for more info). This software
I'm writing will be used to email hundreds of users on a daily basis.
Email message body looks like this for 5-10 users:
-------------------------------------------------
This is a test email. Please ignore and delete.
-------------------------------------------------
Email message body looks like this for a larger number of people
(ab*@test.com is simply a dummy address I'm using for this posting):
-----------------------------------------------------
To:<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>,<ab*@test.com>,<ab*@test.com>,<ab*@test.co m>,<ab*@test.com>,<ab*@test.com>,<ab*@test.com>,<a b*@test.com>,<ab*@test.com>,<ab*@test.com>,<ab*@te st.com>
CC:<ab*@test.com>
Subject: Test: Please ignore
Date: Fri, 16 Sep 2005 12:18:21 -0400
Message-ID: <00c101c5bada$4173eb80$0dfea8c0@odcisweb1>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181
Return-Path: we*******@mycompany.com
X-OriginalArrivalTime: 16 Sep 2005 16:27:57.0147 (UTC)
FILETIME=[98A4D2B0:01C5BADB]
This is a test email. Please ignore and delete.
-----------------------------------------------
I cannot email such a large group of users again and again to find more
specifics. Please help. Why is my email not displaying the message
only? Why is it displaying all the recepients in the message body? Is
there a fix to this problem or do I have