我需要发送大量电子邮件的(大概有几百天)交付基础发送电子邮件的正确方式。 我想这样做的方式如下,但问题是,我的身体领域可以变得非常大,如果我将它添加为字符串它变得丑陋。从Windows服务
SmtpClient client = new SmtpClient(); //host and port picked from web.config
client.EnableSsl = true;
MailMessage message = new MailMessage();
message.Body = "test from winservice"; // HERE IS MY PROBLEM
message.IsBodyHtml = true;
message.From = new MailAddress("[email protected]");
message.Subject = "My subject";
message.To.Add(new MailAddress("[email protected]"));
try
{
client.Send(message);
}
catch (Exception)
{
}
,当我不得不从aspx页面做到这一点,我用
MailDefinition message = new MailDefinition();
message.BodyFileName = @"~\EmailTemplate\Template1.htm";
ListDictionary replacements = new ListDictionary();
replacements.Add("<% Name %>", this.txtName.Text);
replacements.Add("<% PhoneOrEmail %>", this.txtPhoneOrEmail.Text);
replacements.Add("<% Message %>", this.txtMessage.Text);
MailMessage msgHtml = message.CreateMailMessage(RECIPIENTS, replacements, new LiteralControl());
我认为这是很好的解决方案,但我不想提及System.Web.UI.WebControls.MailDefinition 因为我在winservice。
我的问题是:
- 什么是从WINSERVICE发送大量电子邮件 最好的方式?
- 它是更多钞票从Gmail 帐户发送了吗?或者过了一段时间他们会阻止我 ?
感谢您的帮助。
我认为Gmail将有500个收件人在24小时内限制。但是,我不鼓励使用GMail进行批量电子邮件;它可能违反了他们的TOS。 – 2010-03-10 17:11:09
感谢Ryan, 这里是一个帖子,更详细地解释它 http://www.labnol.org/internet/email/gmail-daily-limit-sending-bulk-email/2191/ 所以我想我将不得不停止使用Gmail发送电子邮件:( – UshaP 2010-03-10 18:51:22