473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Mail sent using MailMessage class displays "TO" and "CC" recepients in the message body when sent to large number of recepients

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

Nov 17 '05 #1
0 1324

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: hjbortol | last post by:
Hi! Is the expression "a >= b" equivalent to "a - b >= 0" in C/C++? Is this equivalence an IEEE/ANSI rule? Or is this machine/compiler dependent? Any references are welcome! Thanks in...
21
by: hjbortol | last post by:
Hi! Is the expression "a >= b" equivalent to "a - b >= 0" in C/C++? Is this equivalence an IEEE/ANSI rule? Or is this machine/compiler dependent? Any references are welcome! Thanks in...
5
by: Andrea | last post by:
Hi, I'm a newbie i want to know how can i convert string to its binary representation, i want to write a program where an example string "hello world" is transformed in his binary representation...
36
by: Pat | last post by:
Hi, I've run into a strange problem, but one that seems like it might be fairly common. I have a single base class, from which several other classes are derived. To keep the example simple,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.