473,372 Members | 1,036 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,372 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 8799
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! ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.