JMeter 3.3 - 无法连接到SMTP主机

时间:2018-01-15 14:10:39

标签: email jmeter smtp gmail

我是jmeter的新手并尝试使用Jmeter和SMTP发送电子邮件。

这是我的采样器:

enter image description here

这是错误结果:

Thread Name: REST example 1-3
Sample Start: 2018-01-15 14:34:54 CET
Load time: 21003
Connect Time: 0
Latency: 0
Size in bytes: 173
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 173
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Could not connect to SMTP host: smtp.gmail.com, port: 587

Response headers:


SampleResult fields:
ContentType: 
DataEncoding: null

更改gmail服务器后,我收到类似的错误,如下所示:

Thread Name: REST example 1-1
Sample Start: 2018-01-15 15:32:45 CET
Load time: 21104
Connect Time: 0
Latency: 0
Size in bytes: 173
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 173
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Could not connect to SMTP host: smtp.googlemail.com, port: 587

Response headers:


SampleResult fields:
ContentType: 
DataEncoding: null

我做错了什么?我也试过取消选中强制启动

由于

2 个答案:

答案 0 :(得分:1)

您的服务器链接错误,而不是smtp.gmail.com使用smtp.googlemail.com

最新版本的SMTP Sampler中有changes,请务必使用最新的3.3版本。 另请参阅full SMTP tutorial

此错误也可归因于gmail blocked your IP

  

Google的安全系统阻止了您服务器的IP ..   SMTP错误:无法连接到SMTP主机。"然后你可能会进入这种情况

答案 1 :(得分:1)

首先尝试使用telnet tool或同等版本连接到smtp.gmail.com:587的测试连接。如果你不能 - 你可能就是公司防火墙的背后,你需要“告诉”JMeter使用你的公司代理。

对于HTTP,将下一行添加到 system.properties 文件中:

http.proxyHost=your_proxy_host
http.proxyPort=your_proxy_port
https.proxyHost=your_proxy_host
https.proxyPort=your_proxy_port

用于SMTP设置following property

socksProxyHost=your_proxy_host

您也可以通过-D command-line argument将它们传递给JMeter启动脚本,如:

jmeter -DsocksProxyHost=your_proxy_host

请参阅Apache JMeter Properties Customization Guide文章,详细了解JMeter属性以及设置和覆盖它们的方法。