Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Single email to multiple recipients

Reply
Thread Tools

Single email to multiple recipients

 
 
.Net Newbie
Guest
Posts: n/a
 
      06-30-2004
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 ="(E-Mail Removed)";
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


 
Reply With Quote
 
 
 
 
Franco Figún
Guest
Posts: n/a
 
      06-30-2004
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
UIN: 314408886
Yahoo MSN: (E-Mail Removed)

".Net Newbie" <(E-Mail Removed)> escribió en el mensaje
news:e$(E-Mail Removed)...
> 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 ="(E-Mail Removed)";
> 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
>
>



 
Reply With Quote
 
 
 
 
.Net Newbie
Guest
Posts: n/a
 
      07-01-2004
Franco,

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

-Jeff

"Franco Figún" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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: (E-Mail Removed)
> UIN: 314408886
> Yahoo MSN: (E-Mail Removed)
>
> ".Net Newbie" <(E-Mail Removed)> escribió en el mensaje
> news:e$(E-Mail Removed)...
> > 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 ="(E-Mail Removed)";
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
net/smtp Multiple Email recipients Issue Joseph Clark Ruby 2 10-14-2010 06:05 AM
Sending email to multiple recipients Logesh Subramani Ruby 1 08-05-2008 06:52 AM
multiple email recipients eight02645999@yahoo.com Python 1 02-20-2006 11:01 AM
Multiple Email Recipients depending on Value dmiller23462 ASP General 4 11-16-2004 02:49 PM
smtp module - specifying multiple email recipients? Alex Hunsley Python 2 07-01-2004 01:32 PM



Advertisments