无法使用 maven 插件通过电子邮件发送测试报告



我无法使用 maven 插件通过电子邮件发送测试报告。

错误: 1. [错误]将电子邮件发送到以下服务器失败: smtp.gmail.com:465: 身份验证失败异常 -> [帮助 1]

  1. 向以下服务器发送电子邮件失败: smtp.gmail.com:995: 无法连接到 SMTP 主机: smtp.gmail.com, 端口: 995, 响应: -1 -> [帮助 1]

我也尝试使用端口 465、587,但没有任何效果。任何建议都会真正有所帮助,并且还没有通过互联网获得任何解决方案

**Code:**
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<executions>
<execution>
<id>send a mail</id>
<phase>test</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>true</inherited>
<configuration>
<!-- From Email address -->
<from>test@totalitycorp.com</from>
<!-- Email subject -->
<subject>Yovo Test Automation Report</subject>
<!-- Fail the build if the mail doesnt reach -->
<failonerror>false</failonerror>
<!-- host -->
<mailhost>smtp.gmail.com</mailhost>
<!-- port of the host -->
<mailport>995</mailport>
<mailssl>true</mailssl>
<mailAltConfig>true</mailAltConfig>                     
<!-- Email Authentication(USername and Password) -->
<mailuser>test@gmail.com</mailuser>
<mailpassword>234aASD</mailpassword>
<receivers>
<!-- To Email address -->
<receiver>abhi.c74@gmail.com</receiver>
</receivers>
<fileSets>
<fileSet>
<!-- Report directory Path -->
<directory>/home/maverick/eclipse-workspace/YovoAndroidAutomation/test-output</directory>
<includes>
<!-- Report file name -->
<include>emailable-report.html</include>
</includes>
<!-- Use Regular Expressions like **/*.html if you want all the 
html files to send -->
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>

[错误] 将电子邮件发送到以下服务器失败: smtp.gmail.com:465:需要身份验证 -> [帮助 1]

这是一个非常有趣的问题。如果我们必须从外部来源(而不是Gmail登录(登录Gmail,则需要启用不太安全的选项(即将其设置为"ON"(。

以下是我们的做法:

  • 转到"我的帐户"中的"安全性较低的应用"部分。
  • 在"安全性较低的应用的访问权限"旁边,选择"开启"。

Google Apps 用户请注意: 如果您的管理员锁定了安全性较低的应用帐号访问权限,此设置将被隐藏。

最新更新