本文介绍了如何在 maven Postman-plugin 中启用 STARTLS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在打包阶段发送邮件.我正在使用邮件主机:smtp.gmail.com.端口:587.

I am trying to send a mail during package phase. I am using mail host : smtp.gmail.com. Port: 587.

出现错误:必须先发出 STARTTLS 命令.

Getting error: Must issue a STARTTLS command first.

当我们使用 587 时 - 我们必须启用 STARTLS - 但是我如何使用 Maven Postman 插件启用.

When we use 587 - we must enable STARTLS - but how can I enable using Maven Postman Plugin.

  1. 如何启用 STARTLS
  2. 插件配置中 ma​​ilAltConfig 标记的用途是什么.
  1. How to Enable STARTLS
  2. what is the purpose of mailAltConfig tag in plugin configuration.

构建错误:

BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.386 s
[INFO] Finished at: 2015-03-15T02:35:26+05:30
[INFO] Final Memory: 17M/173M
[INFO] ------------------------------------------------------------------------
[ERROR] Sending the email to the following server failed : smtp.gmail.com:587: 530 5.7.0 Must issue a STARTTLS command first. y2sm9686661pdm.31 - gsmtp ->

我已将 Postman 插件配置为:

I have configured Postman Plugin as:

        <plugin>
        <groupId>ch.fortysix</groupId>
        <artifactId>maven-postman-plugin</artifactId>
        <executions>
                <execution>
                        <id>send a mail</id>
                        <phase>package</phase>
                        <goals>
                                <goal>send-mail</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                                <from>[email protected]</from>
                                <subject>My Project Documentation</subject>
                             <failonerror>true</failonerror>
                            <mailhost>smtp.gmail.com</mailhost>
                            <mailport>587</mailport>
                            <mailAltConfig>true</mailAltConfig>
                            <mailuser>donthadineshkumar</mailuser>
                            <mailpassword>*my password*</mailpassword>
                           <htmlMessageFile>src/main/MailContent.html</htmlMessageFile>
                                <receivers>
                                        <receiver>[email protected]</receiver>
                                </receivers>
                                <fileSets>
                                        <fileSet>
                                                <directory>${basedir}/src/main</directory>
                                                <includes>
                                                        <include>**/*.pdf</include>
                                                </includes>
                                        </fileSet>
                                </fileSets>
                        </configuration>
                </execution>
        </executions>
</plugin>

推荐答案

如果我不使用 ssl 而使用 567 端口,我将面临与您相同的问题.为了解决这个我用<mailport>465</mailport>我成功了

if i am not using ssl and using 567 port i am facing the same issue as you. To solve this I used<mailssl>true</mailssl><mailport>465</mailport>and i was successful

这篇关于如何在 maven Postman-plugin 中启用 STARTLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 06:11