如何在Java中有效地发送批量邮件 [英] How do send bulk mails efficiently in Java

查看:775
本文介绍了如何在Java中有效地发送批量邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要有效的方式,比如200多封邮件/秒。如何才能创建最大数量的线程?还有更好的方法吗?

I want efficient way, like more than 200 mails/seconds. How can maximum number of threads we can create and Is there any much better approach to do that?

推荐答案

批量数据没有效率,你必须耐心等待在这种情况下。



现在让我给你一个答案。如果你能(以某种方式)设法在你的CPU上获得200个线程并允许每个线程向你的客户端发送一封电子邮件。在你拥有一台SMTP服务器并且网络足够强大之前,你仍然无法做到这一点,



There is no efficiency in bulk data, you have to be patient in this scenario.

Now let me give you an answer. If you can (somehow) manage to get 200 threads on your CPU and allow each of this thread to send an email to your client. You still won't be able to, until you are having an SMTP server and the network strong enough to,



  1. 将数据发送到SMTP服务器。
  2. 处理请求并发送电子邮件。
  3. 返回响应;最有可能确定





...全部仅一秒。只有这样,您才能期望批量电子邮件发送程序在一秒 发送200封电子邮件。



如果你不能执行这个......那么唯一剩下的就是耐心。之前我确实回答过类似的问题,并给出了相同的解决方案。电子邮件(以及所有其他类型的网络相关资源和数据)不仅取决于您的线程,CPU和代码效率。它们取决于网络速度和SMTP服务器响应。如果你能够创建(上面提到的)程序但是你的SMTP不够快且足够强大,你仍然无法达到预期的效果。发送批量电子邮件确实需要很多耐心(双方都有;客户端和发件人)。



个人经历......



200封电子邮件/秒不是无障碍;你也不应该为垃圾邮件,批量电子邮件支付幸运饼干。我记得前天我教过我哥哥如何用C#编写应用程序,主题是发送电子邮件。我们创建了一个Windows窗体应用程序,当我们发送(仅一个)电子邮件时;我们使用双核CPU,4 MB互联网连接,SMTP服务器(Gmail)发送的响应是在 4秒之后收到的。



... All in just one second. Only then you can expect your Bulk email sending program to send 200 emails in one second.

If you cannot perform this... Then the only thing left is patience. I did answer similar questions before, and I gave the same solution. Emails (and all other type of network related resources and data) do not only depend on your threads, CPU, code efficiency. They depend on the network speed and the SMTP server response. If you get able to create the (above mentioned) program but your SMTP is not fast and strong enough, you will still not get to the desired results. Sending bulk emails really requires a lot of patience (on both sides; client and sender).

Personal experience...

200 emails/seconds is not accessible; also you should never pay a fortune cookie for spam Whoops, bulk emails. I remember day before yesterday I was teaching my brother how to write applications in C# and the topic was Sending emails. We created a Windows Forms application and when we sent (only one) email; we were using Dual Core CPU, 4 MB internet connection, the response sent by the SMTP server (Gmail) was received after 4 seconds.


这篇关于如何在Java中有效地发送批量邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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