CDO.Message - 发送至多个连接

发布于 2024-07-14 11:49:41 字数 1201 浏览 7 评论 0原文

我正在使用 CDO.Message 编写新闻通讯应用程序。 但得到一个错误,我们有很多连接。 似乎他们有 10 个同时连接的限制。

那么,有没有一种方法可以在一个连接上发送多条消息,或者更快地断开连接? 有一个 cdo/configuration/smtpconnectiontimeout 参数,但我认为这更多的是关于发件人将尝试多长时间。

(如果我们发送失败,几分钟后它会再次成功,可能意味着连接已断开)。

(我们使用 CDO 的部分原因是我们从网络服务器中提取 HTML 消息正文)

编辑

Public Sub ipSendMail(ByVal toEmail As String, ByVal fromEmail As String, ByVal subject As String, ByVal url As String)
    Dim iMsg As Object
    Set iMsg = CreateObject("CDO.Message")
    iMsg.From = fromEmail
    iMsg.To = toEmail
    iMsg.Subject = subject
    iMsg.CreateMHTMLBody(url)
    iMsg.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    iMsg.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay.wwwwwwwwww.net"
    iMsg.Configuration.Fields.Item_
        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    iMsg.Configuration.Fields.Item _ 
        ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 0
    iMsg.Configuration.Fields.Update()
    iMsg.Send()
    Set iMsg = Nothing
End Sub

I am writing a newsletter application using CDO.Message. But get an error back that we have to many connections. Seems they have a limit of 10 simultaneous connections.

So, is there a way to send several messages on one connection, or disconnect faster?
There is a cdo/configuration/smtpconnectiontimeout parameter, but I think that's more about how long the sender will try.

(If we send,ant it fails, it will succeed again after some minutes, probably meaning that the connection is disconnected).

(We are using CDO partly because we are pulling the HTML message body from a webserver)

Edit:

Public Sub ipSendMail(ByVal toEmail As String, ByVal fromEmail As String, ByVal subject As String, ByVal url As String)
    Dim iMsg As Object
    Set iMsg = CreateObject("CDO.Message")
    iMsg.From = fromEmail
    iMsg.To = toEmail
    iMsg.Subject = subject
    iMsg.CreateMHTMLBody(url)
    iMsg.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    iMsg.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay.wwwwwwwwww.net"
    iMsg.Configuration.Fields.Item_
        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    iMsg.Configuration.Fields.Item _ 
        ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 0
    iMsg.Configuration.Fields.Update()
    iMsg.Send()
    Set iMsg = Nothing
End Sub

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

狼亦尘 2024-07-21 11:49:41
  • 尝试使用 SMTP 而不是 CDO,System.Web.Mail.SmtpMail
  • 您可以实现一个由后台线程处理的队列。 后台线程一次只会发送一条消息。
  • 您可以将电子邮件存储在数据库表中,该表由计划任务或存储过程处理。 这些可以再次一次发送一封邮件,并且具有在出现问题时能够重试的优点。
  • Try to use SMTP instead of CDO, System.Web.Mail.SmtpMail
  • You could implement a queue, that is processed by a background thread. The background thread would only send one message at a time.
  • You can store the email in a database table, which is processed by a scheduled task or a stored procedure. Those can again send one mail at a time, and have the advantage of being able to retry, if it goes wrong.
柒七 2024-07-21 11:49:41

通常,无论您发送多少消息,您都只需要一个连接。

也许你没有发布你应该发布的东西。

编辑:只是想一下,您要发送到的 SMTP 服务器可能出于测试原因而不会恰好托管在 XP 机器上?

编辑:好的,您的 SMTP 服务器没问题。

提供 URL 结果的服务器是什么平台?

Ordinarily you only need one connection regardless of how many messages you are sending.

Perhaps you are not releasing something that you should be.

Edit: Just a thought, the SMTP server you are sending to, it wouldn't happen to be host on an XP box perhaps for testing reasons?

Edit: Ok so your SMTP server is fine.

What platform is the server supplying the result of the URL?

乖不如嘢 2024-07-21 11:49:41

我知道 CDO 有时可能很奇怪,所以这些是我可能提出的建议:

队列可能最适合您。 之后,我会考虑设置一个没有入站连接限制的本地 SMTP 服务器,该服务器使用智能主机对出站邮件进行排队。 (这实际上可以很容易地编写。“S”代表“简单”,而且确实如此。)

如果所有其他方法都失败了...您可以随时推出自己的邮件程序组件来实现 RFC 2821 和 2822(或任何最新的和最大的 RFC 是针对 SMTP 和消息格式)

编辑:如果您发送的时事通讯对于所有收件人都是相同的,您可以将其发送给虚拟收件人(即 [电子邮件受保护])并将其密送至收件人列表(或收件人列表的子集)。 请注意不要被标记为未经请求的商业电子邮件。 让您的提供者知道您在做什么。 他们必须处理投诉,而你就是买单的人。 让他们知道投诉大多是毫无根据的(而且很少)将有助于缓解他们自然的风险厌恶情绪。

I know that CDO can be quirky at times, so these are the possible suggestions that I would make:

A queue would probably work the best for you. After that, I would consider setting up a local SMTP server without inbound connection limits that uses a smarthost to queue up your outbound messages. (This could actually be written fairly easily. The "S" is for "Simple" and it actually is.)

If all else fails... You could always roll your own mailer component implementing RFCs 2821 and 2822 (or whatever the latest and greatest RFCs are for SMTP and message format)

EDIT: If the newsletter you are sending out is identical for all recipients, you can address it to a dummy recipient (i.e. [email protected]) and BCC it to the recipient list (or a subset of the recipient list). Just be careful not to get flagged as unsolicited commercial email. Let your provider know what you are doing. They have to deal with the complaints, and you are the one paying the bill. Letting them know that complaints would be mostly unwarranted (and few and far between) will help to assuage their natural risk aversion.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文