简体   繁体   English

Gmail SMTP服务器请求/秒有任何限制吗?

[英]Is there any limit to Gmail SMTP server requests/ sec?

I am trying to send email using Gmail SMTP server from java (deployed in tomcat). 我正在尝试通过Java使用Gmail SMTP服务器发送电子邮件(已在tomcat中部署)。 When doing load testing if the number of request / sec to SMTP server grows more (>20) I get this exception 在进行负载测试时,如果对SMTP服务器的请求/秒数增长更多(> 20),则会出现此异常

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587;

nested exception is:java.net.ConnectException: Connection timed out

Is there any limitations in access rate for Gmail SMTP server ? Gmail SMTP服务器的访问速率是否有限制? Should I introduce delay between each request ? 我应该在每个请求之间引入延迟吗?

After some searching, introducing a delay between every email getting sent is the way to go if you want to keep using the SMTP servers from Google. 经过一番搜索后,如果要继续使用Google的SMTP服务器,可以在发送每封电子邮件之间引入延迟。 However, from what I read, a significant delay is required for these SMTP servers in order for them not to forcibly close your connection and actively drop new connections (by significant delay, I mean delays of more than 60 seconds). 但是,据我了解,这些SMTP服务器需要大量的延迟才能使它们不能强行关闭您的连接并主动断开新连接(严重延迟是指超过60秒的延迟)。 Load testing is out of the question this way: modern computers should be able to process sending an email within 60 seconds without any problems. 负载测试是绝对不可能的:现代计算机应该能够在60秒内处理电子邮件发送而没有任何问题。

Bottom line: don't use Gmail SMTP for load testing. 底线:请勿使用Gmail SMTP进行负载测试。 I would recommend setting up your own SMTP server which you can use, or maybe (temporarily) get an account at a professional mailing service. 我建议您设置自己的SMTP服务器以供使用,或者(临时)在专业的邮件服务处获得一个帐户。 Keep in mind though, that if you host your own SMTP server, there is a possibility that your software performs the way it should, but that the SMTP server can have spam protection (by default). 但是请记住,如果您托管自己的SMTP服务器,则软件可能会执行应有的方式,但是SMTP服务器可以具有垃圾邮件保护功能(默认情况下)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM