• <bdo id='HFY38'></bdo><ul id='HFY38'></ul>

    <small id='HFY38'></small><noframes id='HFY38'>

        <tfoot id='HFY38'></tfoot>
      1. <legend id='HFY38'><style id='HFY38'><dir id='HFY38'><q id='HFY38'></q></dir></style></legend>
        <i id='HFY38'><tr id='HFY38'><dt id='HFY38'><q id='HFY38'><span id='HFY38'><b id='HFY38'><form id='HFY38'><ins id='HFY38'></ins><ul id='HFY38'></ul><sub id='HFY38'></sub></form><legend id='HFY38'></legend><bdo id='HFY38'><pre id='HFY38'><center id='HFY38'></center></pre></bdo></b><th id='HFY38'></th></span></q></dt></tr></i><div id='HFY38'><tfoot id='HFY38'></tfoot><dl id='HFY38'><fieldset id='HFY38'></fieldset></dl></div>

        使用 System.Net.Mail 加速通过 smtp 服务器发送多封电子邮件

        时间:2023-10-05
      2. <small id='08IXI'></small><noframes id='08IXI'>

            <legend id='08IXI'><style id='08IXI'><dir id='08IXI'><q id='08IXI'></q></dir></style></legend>
          1. <i id='08IXI'><tr id='08IXI'><dt id='08IXI'><q id='08IXI'><span id='08IXI'><b id='08IXI'><form id='08IXI'><ins id='08IXI'></ins><ul id='08IXI'></ul><sub id='08IXI'></sub></form><legend id='08IXI'></legend><bdo id='08IXI'><pre id='08IXI'><center id='08IXI'></center></pre></bdo></b><th id='08IXI'></th></span></q></dt></tr></i><div id='08IXI'><tfoot id='08IXI'></tfoot><dl id='08IXI'><fieldset id='08IXI'></fieldset></dl></div>
              <bdo id='08IXI'></bdo><ul id='08IXI'></ul>

              1. <tfoot id='08IXI'></tfoot>

                    <tbody id='08IXI'></tbody>
                  本文介绍了使用 System.Net.Mail 加速通过 smtp 服务器发送多封电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 C# 的新手,但我从 VB.Net 学到了很多关于在 .Net for windows 中编程的知识.

                  I am quite a newbie in C# but I have learnt a lot from VB.Net about programming in .Net for windows.

                  我刚刚制作了一个简单的 SMTP 客户端,它从程序中发送电子邮件.它是一个控制台应用程序,一次只能通过服务器发送一封电子邮件.这非常慢,我需要通过我的客户端同时发送多封电子邮件.

                  I have just made a simple SMTP client which sends emails from the program. It is a console application and can only send one email through the server at a time. This is very slow and I need to send multiple emails through my client at the same time.

                  这在 C# 中可行吗?

                  Is this possible in C#?

                  推荐答案

                  只需使用多线程(多进程)即可.

                  simply use multiple threads (multiple processes).

                  在 C# 中,您可以使用任务来完成此操作.

                  In C# you can do this with a Task.

                  new Task(delegate { 
                      smtpClient.send(myMessage); 
                  }).Start();
                  

                  只需将您的 send 命令包装在此对象中,它将异步发送.

                  Just wrap your send command in this object and it will be send Asynchronously.

                  小心,如果它被包裹在一个循环中,它将为每封邮件启动一个新进程.

                  Be careful if this is wrapped in a loop it will start a new process for each mail.

                  如果您需要同时发送大量邮件,我建议您使用ThreadPool.它使您可以控制要同时拥有多少并发线程.

                  if you need to send large amounts of mails at the same time I suggest you use a ThreadPool. It lets you control how many concurent threads you'd like to have at the same time.

                  这篇关于使用 System.Net.Mail 加速通过 smtp 服务器发送多封电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Log4net html 格式化的 SmtpAppender 下一篇:System.Net.Mail 和 MailMessage 不立即发送消息

                  相关文章

                  <small id='c5w3N'></small><noframes id='c5w3N'>

                • <i id='c5w3N'><tr id='c5w3N'><dt id='c5w3N'><q id='c5w3N'><span id='c5w3N'><b id='c5w3N'><form id='c5w3N'><ins id='c5w3N'></ins><ul id='c5w3N'></ul><sub id='c5w3N'></sub></form><legend id='c5w3N'></legend><bdo id='c5w3N'><pre id='c5w3N'><center id='c5w3N'></center></pre></bdo></b><th id='c5w3N'></th></span></q></dt></tr></i><div id='c5w3N'><tfoot id='c5w3N'></tfoot><dl id='c5w3N'><fieldset id='c5w3N'></fieldset></dl></div>

                  <tfoot id='c5w3N'></tfoot>
                  <legend id='c5w3N'><style id='c5w3N'><dir id='c5w3N'><q id='c5w3N'></q></dir></style></legend>
                        <bdo id='c5w3N'></bdo><ul id='c5w3N'></ul>