可以使用GMail发mail,据说G官方限制一天内同一封邮件最多发送到500个联系人。代码如下:
namespace ConsoleApplication9 { class Program { static void Main(string[] args) { var from = new MailAddress("asdf@112.com", "cary"); var to = new MailAddress("chenghui921@126.com", "toname"); var message = new MailMessage(from, to); message.Subject = "The subject"; message.Body = "The message body"; message.IsBodyHtml = true; var host = "smtp.gmail.com"; var client = new SmtpClient(host, 587); client.EnableSsl = true; client.Credentials = new NetworkCredential("<<your username>>", "<<your password>>"); client.Send(message); Console.ReadLine(); } } }
作者:生鱼片
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。