string body = "有新的定单";
SmtpClient smpt = new SmtpClient("*.*.*.*");
MailAddress from=new MailAddress("[email protected]") ;
MailAddress To = new MailAddress("[email protected]");
MailMessage mail = new MailMessage(from,To);
mail.Subject = "定单";
mail.Body = body;
mail.Attachments.Add(new Attachment(path));
mail.Priority = MailPriority.High;
smpt.Send(mail);
在这段代码中我要实现把邮件发送给多个地址,该怎么弄 各位高手帮忙说说
SmtpClient smpt = new SmtpClient("*.*.*.*");
MailAddress from=new MailAddress("[email protected]") ;
MailAddress To = new MailAddress("[email protected]");
MailMessage mail = new MailMessage(from,To);
mail.Subject = "定单";
mail.Body = body;
mail.Attachments.Add(new Attachment(path));
mail.Priority = MailPriority.High;
smpt.Send(mail);
在这段代码中我要实现把邮件发送给多个地址,该怎么弄 各位高手帮忙说说
不要用下面这样,麻烦,还要创建对象:
MailAddress from=new MailAddress("[email protected]") ;
MailAddress To = new MailAddress("[email protected]");
无法将类型“string”隐式转换为“System.Net.Mail.MailAddress”
objMessage.To=strTo;不行吗? 我一直这样用.
SmtpClient smpt = new SmtpClient("*.*.*.*");
MailMessage mail = new MailMessage();
mail.Subject = "定单";
mail.Body = body;mail.From = "[email protected],[email protected]";
mail.To = "[email protected],[email protected]";mail.Attachments.Add(new Attachment(path));
mail.Priority = MailPriority.High;
smpt.Send(mail);
while(count>0)
{
mail.to = new MailAddress("[email protected]");
mail.send();
count--;
}
while(count>0)
{
mail.to = new MailAddress("[email protected]");
smpt.Send(mail);
count--;
}这样也不行吗?
没理由啊?