可以使用GMail發mail,據說G官方限制一天內同一封郵件最多發送到500個聯系人。代碼如下:
namespace ConsoleApplication9 { class Program { static void Main(string[] args) { var from = new MailAddress("[email protected]", "cary"); var to = new MailAddress("[email protected]", "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(); } } }