View previous topic :: View next topic |
Author |
Message |
danyseb
Joined: 29 Nov 2005 Posts: 1
|
Posted: Tue Nov 29, 2005 5:49 am Post subject: build a maillist |
|
|
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 |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Wed Nov 30, 2005 9:05 pm Post subject: |
|
|
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 |
|
|
|
|
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
|