什么是发送电子邮件的大批量在ASP.NET的最好方法? [英] What is the best way to send large batches of emails in ASP.NET?

查看:125
本文介绍了什么是发送电子邮件的大批量在ASP.NET的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在通过一个DataReader循环和调用System.Net.Mail.SmtpClient的send()方法。与此问题是,它是缓慢的。每封电子邮件大约需要5-10秒发送(这是可能的,这是我的主机只是一个问题)。我不得不重写我的web.config文件中的executionTimeout默认值(默认为90秒)是这样的:

I'm currently looping through a datareader and calling the System.Net.Mail.SmtpClient's Send() method. The problem with this is that it's slow. Each email takes about 5-10 seconds to send (it's possible this is just an issue with my host). I had to override the executionTimeout default in my web.config file (it defaults to 90 seconds) like this:

 <httpRuntime executionTimeout="3000" />

警告:我是一个共享的主机上,所以我不认为这是可能对我使用PickupDirectoryFromIis选项(至少,它给了我错误,当我打开它)发送

One caveat: I'm on a shared host, so I don't think it is possible for me to send using the PickupDirectoryFromIis option (at least, it gave me errors when I turned it on).

推荐答案

您可以发送邮件异步的。这样的超时不应该打断你的发送。

You could send the mail asynchronous. That way the timeout should not interrupt your sending.

这个文章应该帮助您开始与:在C#异步发送电子邮件。

This article should help you get started with that: Sending Emails Asynchronously in C#.

有一个办法在这里: http://www.vikramlakhotia.com/Sending_Email_asynchronously_in_AspNet_20.aspx

和关闭过程中有几个商业客户可用,但我都试过,可以推荐的唯一一个是的http:/ /www.aspnetemail.com/

And off course there are several commercial clients available, but the only one that i have tried and can recommend is http://www.aspnetemail.com/

这篇关于什么是发送电子邮件的大批量在ASP.NET的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆