我使用asp.net网络表单制作了一个邮件程序,在其中我将邮件发送到了多个像这样的食谱-
void SendHTMLMail()
{
StreamReader reader = new StreamReader(Server.MapPath("~/one.html"));
string readFile = reader.ReadToEnd();
myString = readFile;
MailMessage Msg = new MailMessage();
Msg.From = new MailAddress(txtUsername.Text);
// Msg.To.Add(txtTo.Text);
string[] toAddressArray;
toAddressArray = txtTo.Text.ToString().Split(new char[] { ',' });
foreach (string a in toAddressArray)
{
Msg.To.Add(a);
}
Msg.Subject = txtSubject.Text;
Msg.Body = myString.ToString();
Msg.IsBodyHtml = true;
if (fuAttachment.HasFile)
{
string FileName = Path.GetFileName(fuAttachment.PostedFile.FileName);
Msg.Attachments.Add(new Attachment(fuAttachment.PostedFile.InputStream, FileName));
}
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential(txtUsername.Text, txtpwd.Text);
smtp.EnableSsl = true;
smtp.Send(Msg);
Msg = null;
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
}
现在我要做的是将收件人的电子邮件ID保存在数据库中。
我如何存储数据,以使来自文本框的多个收件人存储在不同行的同一列下,而我从中设置邮件的电子邮件ID在所有行的其他列中都保持不变