首页 > 解决方案 > 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>

标签: javamavenemailpom.xmlstarttls

解决方案


推荐阅读