i have a simple script that sends emails to our users.
I have no problem sending the emails but what bothers me that i have to specify the "TO" field.. so each user that receives an email as a BCC can see the to field ("admin@domain.com") which is the same as the "From" field.
Basically want i want to have is each user in the bcc field see their own email address instead of "admin@domain.com" as the to field.
Here's my code so far
MailMessage mm = new MailMessage("admin@domain.com", "admin@domain.com", this.txtSubject.Text, this.txtBodyHtml.Text);
mm.IsBodyHtml = true;
// go through records and add them to email list
while (rs.Read()){
mm.Bcc.Add(new MailAddress(rs["Email"].ToString(), rs["FullName"].ToString()));
}
SmtpClient mailClient = new SmtpClient();
try{
//Send the email asynchronously
mailClient.SendAsync(mm, null);
}catch (SmtpException smtpEx){
//sendErrors.Add(smtpEx.InnerException.Message);
//throw smtpEx;
}catch (Exception ex){
//sendErrors.Add(ex.Message);
//throw ex;
}