C#
MailAddress from = [COLOR=blue]new[/COLOR] MailAddress([COLOR=maroon][COLOR=maroon]"[email protected]"[/COLOR][/COLOR], [COLOR=maroon][COLOR=maroon]"Ben Miller"[/COLOR][/COLOR]);
MailAddress to = [COLOR=blue]new[/COLOR] MailAddress([COLOR=maroon][COLOR=maroon]"[email protected]"[/COLOR][/COLOR], [COLOR=maroon][COLOR=maroon]"Jane Clayton"[/COLOR][/COLOR]);
MailMessage message = [COLOR=blue]new[/COLOR] MailMessage(from, to);
message.Subject = [COLOR=maroon][COLOR=maroon]"Using the SmtpClient class."[/COLOR][/COLOR];
message.Body = @[COLOR=maroon][COLOR=maroon]"Using this feature, you can send an e-mail message from an application very easily."[/COLOR][/COLOR];
[COLOR=green]// No teu caso aki vais lendo os emails da BD com um foreach ou como achares melhor[/COLOR]
message[COLOR=#0000ff].CC.Add(new MailAddress("blah1"));
[/COLOR] message[COLOR=#0000ff].CC.Add(new MailAddress("blah2"));
[/COLOR] message[COLOR=#0000ff].CC.Add(new MailAddress("blah3"));
continua....
[/COLOR]
Vamos la ver .. tu queres mandar um mail para varias pessoas ? tipo CC ? e tens os emails para os quais enviar numa bd ?
podes ver o resto do codigo aki http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.cc.aspxCódigo:C# MailAddress from = [COLOR=blue]new[/COLOR] MailAddress([COLOR=maroon][COLOR=maroon]"[email protected]"[/COLOR][/COLOR], [COLOR=maroon][COLOR=maroon]"Ben Miller"[/COLOR][/COLOR]); MailAddress to = [COLOR=blue]new[/COLOR] MailAddress([COLOR=maroon][COLOR=maroon]"[email protected]"[/COLOR][/COLOR], [COLOR=maroon][COLOR=maroon]"Jane Clayton"[/COLOR][/COLOR]); MailMessage message = [COLOR=blue]new[/COLOR] MailMessage(from, to); message.Subject = [COLOR=maroon][COLOR=maroon]"Using the SmtpClient class."[/COLOR][/COLOR]; message.Body = @[COLOR=maroon][COLOR=maroon]"Using this feature, you can send an e-mail message from an application very easily."[/COLOR][/COLOR]; [COLOR=green]// No teu caso aki vais lendo os emails da BD com um foreach ou como achares melhor[/COLOR] message[COLOR=#0000ff].CC.Add(new MailAddress("blah1")); [/COLOR] message[COLOR=#0000ff].CC.Add(new MailAddress("blah2")); [/COLOR] message[COLOR=#0000ff].CC.Add(new MailAddress("blah3")); continua.... [/COLOR]
....
fazes a query atribuir o resultado da query a um dataset(ds) por exemplo depois
foreach(Datarow row in ds.Tables[0].row)
{
message[COLOR=#0000ff].CC.Add(new MailAddress(row["email"]));
[/COLOR]
}