ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

build a maillist

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#)
View previous topic :: View next topic  
Author Message
danyseb



Joined: 29 Nov 2005
Posts: 1

PostPosted: Tue Nov 29, 2005 5:49 am    Post subject: build a maillist Reply with quote

hi i am new programing.. now i do a maillist send but for send i need to chosse a mail in my dropdownlist. WHAT CODE I NEED TO WRITE FOR THAT EVERY MAIL FOUND AT MY TABLE MAIL EXECUTE THIS FUNCTION ... BECAUSE I WANNA THAT MAILLIST WORKS SENDING MAILS TO ALL SUSCRIBERS.
can you understand my Idea ?

void SendNewletter(Object s, EventArgs e) {
MailMessage objMail = new MailMessage();
objMail.From = "mi@mi.com";
objMail.To = ddlto.SelectedItem.Text; // <<<-- HERE!!!!!!!!!
objMail.Subject = txtSubject.Text;
objMail.BodyFormat = MailFormat.Html;
objMail.Body = "<html><head><title>" +
HttpUtility.HtmlEncode(txtSubject.Text) +
"</title></head><body>";
objMail.Body +="<img src=\"http://localhost/images/" + "logo.gif\" />";
objMail.Body +="<p>" +
HttpUtility.HtmlEncode(txtIntroduction.Text) + "</p>";
objMail.Body += "<p>Employee of the month: " +
HttpUtility.HtmlEncode(txtEmployee.Text) + "</p>";
objMail.Body += "<p>This Months featured event: " +
HttpUtility.HtmlEncode(txtStoreItem.Text) + "</p>";
objMail.Body += "</body></html>";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(objMail);
lblResult.Text = "The Newsletter has been sent!";
}

not , i now using a dropdownlist, i have a checkbox that says "all senders" , i want to check this and do clic on "send mail" and system check that checkbox is market send mail to every mails of datatable.

i hope you can helpme
_________________
i am here.. but i dont feel..
Back to top
View user's profile Send private message Send e-mail MSN Messenger
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Wed Nov 30, 2005 9:05 pm    Post subject: Reply with quote

You can select all emails in your table into a recordset, and then add them as recepients within a loop. Something like that:

sSQL = "SELECT Email FROM tblEmails"
Set oRS = oConn.Execute(sSQL)

While Not oRS.EOF

sMailTo = sMailTo & oRS("Email") & ";"

Wend

Set oRS = Nothing

objMail.To = sMailTo
_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial