0

Good evening to all. In my C# WinApp I sending an e-mail in this way:

mail.To.Add (new MailAddress ("firstname.lastname @ domain.com"));

Now, I would like to send an mail to a list of users stored in a table of MySQL database. Which is the best approach for this? Thanks in advance.

Gianni Giordano
  • 143
  • 1
  • 2
  • 13
  • How does one order the approaches to determine what is "*best*"? The quickest, easiest, most feature-rich approach would be to find a ready made product that will send the emails (customising for each recipient as desired), track those that have been opened, handle bounces and unsubscribe requests, provide an autoresponder, provide simple reporting... – eggyal May 24 '13 at 19:13

1 Answers1

1

Create your query and loop through the reader like this:

Sqldatareader rdr = sqlcommand_variable.ExecuteReader();
While (rdr.read()) {
    mail.To.Add(new MailAddress(rdr['firstname'] + "." + rdr['lastname'] + "@domain.com"));
}
StaticVoid
  • 1,539
  • 10
  • 11