java - SMTP:得到响应代码 530,响应:530 5.7.57 问题,同时使用 POM.xml 文件执行电子邮件配置
问题描述
我在 POM.xml 文件中使用以下插件在完成测试执行后通过电子邮件发送报告。但出现以下问题 - SMTP:得到响应代码 530,响应:
530 5.7.57 SMTP;客户端未通过身份验证以发送匿名邮件。
我检查了一些解决方案,建议设置属性
mailProps.put("mail.smtp.starttls.enable", "true"),
但是当我在 POM 中设置配置时,无法理解应该使用什么标签将 starttls 设置为 true。
在 POM 中为电子邮件设置的插件:
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.6</version>
<executions>
<execution>
<id>send a mail</id>
<phase>test</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>true</inherited>
<configuration>
<!-- From Email address -->
<from>emailname@in.health.com</from>
<!-- Email subject -->
<subject>Test Automation Report</subject>
<!-- Fail the build if the mail doesnt reach -->
<failonerror>true</failonerror>
<!-- host -->
<mailhost>smtp.office365.com</mailhost>
<!-- port of the host -->
<mailport>587</mailport>
<mailssl>false</mailssl>
<mailAltConfig>true</mailAltConfig>
<!-- Email Authentication(USername and Password) -->
<mailuser>emailname@in.health.com</mailuser>
<mailpassword>password</mailpassword>
<receivers>
<!-- To Email address -->
<receiver>emailName@in.health.com</receiver>
</receivers>
<fileSets>
<fileSet>
<!-- Report directory Path -->
<directory>C://Users//narayan//git//com.rxcorp//PlaftformAutomation//test-output</directory>
<includes>
<!-- Report file name -->
<include>customized-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>
解决方案
推荐阅读
- javascript - 如何创建现有 HTML 页面的虚拟 dom?
- powerbi - 如何在 Power BI 中发布连接器的更新版本?
- javascript - 如何在jQuery中单击时附加元素
- php - 从数据库中选择时如何从一个字符串中分离值?
- c++ - 如何在 C++ v60 中实现 std:map?
- javascript - React Datasheet Grid - 记录复制/粘贴值
- python - 语音翻译持续集成事件合成代码的执行问题
- python - jupyter notebook 不会立即中断
- markdown - 雨果动态决定“不安全”
- spring-boot - 我的 spring-boot 应用程序没有连接到 mysql 数据库