可以使用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(); } }
}
本文转自生鱼片博客园博客,原文链接:http://www.cnblogs.com/carysun/archive/2009/11/12/sendmail-by-gmail.html,如需转载请自行联系原作者