如何发送带有附件的批量邮件 [英] How to send a bulk mail with attachment
本文介绍了如何发送带有附件的批量邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何将相同的内容和附件发送给许多人
帮助pl
问候,
Praveen
Hello All,
How to send the same content and attachment to many persons
Help pl
Regards,
Praveen
推荐答案
此处有一个通用例程: ^ ]
您所要做的就是将"to"参数更改为字符串数组,然后一行:
There is a generic routine here: Sending an Email in C# with or without attachments: generic routine.[^]
All you have to do is change the "to" parameter to an array of strings, and the line:
mail.To.Add(new MailAddress(to));
到循环:
foreach (string toAdd in to)
{
mail.To.Add(new MailAddress(toAdd));
}
Hi,
//Sending Mail with attachement
MailMessage mail = new MailMessage();
mail.To ="me@mycompany.com;him@hiscompany.com;her@hercompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body.";
MailAttachment attachment = new MailAttachment( Server.MapPath( "test.txt" ) );
mail.Attachments.Add( attachment ); //add the attachment
SmtpMail.SmtpServer = "smtp.gmail.com"; //your real server goes here
SmtpMail.Send( mail );
这篇关于如何发送带有附件的批量邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文