473,387 Members | 1,379 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,387 software developers and data experts.

Single email to multiple recipients

Hello,

I am currently coding my ASP.Net pages in c# and have run into a question
concerning Emails. I have four objects on a page (six including 2 buttons).
The first is a subject line (textbox) , the next is the email body (a
Textbox with multiple rows), an email address (textbox), and a DropDownList
containing multiple email addresses (populated from a SQL Server table).
The way this page functions is that a user types in the email subject and
body in two of the textboxes. The user can then enter additonalal email
addresses into the single email address textbox and upon pushing a button
the email address is validated and added to the DropDownList (if it's
valid). Upon clicking another button the information is currently being
added to a SQL Server table. I would also like to send this message to each
email address in the DropDownList. I have successfully gotten this to work
when I use one email address but the code chokes when I have multiple email
addresses or actually only sends the information to the first recipient. My
code so far is as follows:
// Table insert (try)
ListItem[] myListItemArray = new ListItem[Assigned.Items.Count];
Assigned.Items.CopyTo(myListItemArray, 0);
foreach(ListItem i in myListItemArray){
MailMessage mailMsg = new MailMessage();
mailMsg.From ="so*******@thecompany.com";
if (i.Value == null){
mailMsg.To = i.Text;
} else {
mailMsg.To = i.Value;
}
mailMsg.Subject = caseStyle.Text + " : " + NoteTitle.Text;
mailMsg.Body = NoteBody.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mailMsg);
}
// catch etc here

If anyone can assist me with how to send an email to multiple recipients
while reading the information from a DropDownList, I would greatly
appreciate it.

Thanks,
Jeff
Nov 18 '05 #1
2 8801
Maybe this example is useful for you.
http://www.aspfree.com/c/a/ASP%20Cod...rom-a-database

--
FF
www.francofigun.com.ar
www.microsofties.com.ar
MSN: fr*********@hotmail.com
UIN: 314408886
Yahoo MSN: fr******@yahoo.com.ar

".Net Newbie" <jc******@hotmail.com> escribió en el mensaje
news:e$*************@tk2msftngp13.phx.gbl...
Hello,

I am currently coding my ASP.Net pages in c# and have run into a question
concerning Emails. I have four objects on a page (six including 2 buttons). The first is a subject line (textbox) , the next is the email body (a
Textbox with multiple rows), an email address (textbox), and a DropDownList containing multiple email addresses (populated from a SQL Server table).
The way this page functions is that a user types in the email subject and
body in two of the textboxes. The user can then enter additonalal email
addresses into the single email address textbox and upon pushing a button
the email address is validated and added to the DropDownList (if it's
valid). Upon clicking another button the information is currently being
added to a SQL Server table. I would also like to send this message to each email address in the DropDownList. I have successfully gotten this to work
when I use one email address but the code chokes when I have multiple email addresses or actually only sends the information to the first recipient. My code so far is as follows:
// Table insert (try)
ListItem[] myListItemArray = new ListItem[Assigned.Items.Count];
Assigned.Items.CopyTo(myListItemArray, 0);
foreach(ListItem i in myListItemArray){
MailMessage mailMsg = new MailMessage();
mailMsg.From ="so*******@thecompany.com";
if (i.Value == null){
mailMsg.To = i.Text;
} else {
mailMsg.To = i.Value;
}
mailMsg.Subject = caseStyle.Text + " : " + NoteTitle.Text;
mailMsg.Body = NoteBody.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mailMsg);
}
// catch etc here

If anyone can assist me with how to send an email to multiple recipients
while reading the information from a DropDownList, I would greatly
appreciate it.

Thanks,
Jeff

Nov 18 '05 #2
Franco,

I got it working using the emample in this article. Thanks for the nudge in
the right direction.

-Jeff

"Franco Figún" <fr*****@fibertel.com.ar> wrote in message
news:eg**************@TK2MSFTNGP12.phx.gbl...
Maybe this example is useful for you.
http://www.aspfree.com/c/a/ASP%20Cod...rom-a-database
--
FF
www.francofigun.com.ar
www.microsofties.com.ar
MSN: fr*********@hotmail.com
UIN: 314408886
Yahoo MSN: fr******@yahoo.com.ar

".Net Newbie" <jc******@hotmail.com> escribió en el mensaje
news:e$*************@tk2msftngp13.phx.gbl...
Hello,

I am currently coding my ASP.Net pages in c# and have run into a question concerning Emails. I have four objects on a page (six including 2

buttons).
The first is a subject line (textbox) , the next is the email body (a
Textbox with multiple rows), an email address (textbox), and a

DropDownList
containing multiple email addresses (populated from a SQL Server table).
The way this page functions is that a user types in the email subject and body in two of the textboxes. The user can then enter additonalal email
addresses into the single email address textbox and upon pushing a button the email address is validated and added to the DropDownList (if it's
valid). Upon clicking another button the information is currently being
added to a SQL Server table. I would also like to send this message to

each
email address in the DropDownList. I have successfully gotten this to work when I use one email address but the code chokes when I have multiple

email
addresses or actually only sends the information to the first recipient.

My
code so far is as follows:
// Table insert (try)
ListItem[] myListItemArray = new ListItem[Assigned.Items.Count];
Assigned.Items.CopyTo(myListItemArray, 0);
foreach(ListItem i in myListItemArray){
MailMessage mailMsg = new MailMessage();
mailMsg.From ="so*******@thecompany.com";
if (i.Value == null){
mailMsg.To = i.Text;
} else {
mailMsg.To = i.Value;
}
mailMsg.Subject = caseStyle.Text + " : " + NoteTitle.Text;
mailMsg.Body = NoteBody.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mailMsg);
}
// catch etc here

If anyone can assist me with how to send an email to multiple recipients
while reading the information from a DropDownList, I would greatly
appreciate it.

Thanks,
Jeff


Nov 18 '05 #3

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

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
2
by: Alex Hunsley | last post by:
I'm using the smtp module to send emails from python. I would like to specify several recipients of the email like follows: msg = MIMEText(time.ctime("Body text of email") me =...
1
by: eight02645999 | last post by:
hi i currently am using this email function that can send single email address def email(HOST,FROM,TO,SUBJECT,BODY,CC=None): import smtplib import string, sys body = string.join(( "From: %s" %...
0
by: gillespie.amanda | last post by:
How do I add a Sender name to the emails sent by the following script: def createhtmlmail (html, text, subject): """Create a mime-message that will render HTML in popular MUAs, text in better...
1
by: handokowidjaja | last post by:
Hi All, Several weeks ago i started a topic with the same subject, however the solutions provided was for using MS Outlook (fullblown version). I finally found something that works directly with...
2
by: Kosmos | last post by:
Alright so I've got this Outlook code written in VBA in Access. The first part, which works, records information about appointment times based on the required days before notification of certain...
2
by: Lazareth | last post by:
Hi, I am trying to write a program to send email messages to selected recipients on a form when a button is clicked (each recipient has a checkbox) . The recipient section I can work out, but I...
0
by: blat001 | last post by:
Hi, Not 100% sure if this is the correct group to post in but. I have a class that I want to serialize/deserialize to match the MM7 specifications, which I have done but now that we are...
2
by: kennykenn | last post by:
Hi, Ive producd code to send an email after capturing info off a form,it works fine locally but when i put it live it doesnt work! the code is stopin at 'msg.send' any ideas, here the code! ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.