Email ant任务发送电子邮件-邮件类型不为';t不支持嵌套的";附件「;要素

Email ant任务发送电子邮件-邮件类型不为';t不支持嵌套的";附件「;要素,email,ant,task,Email,Ant,Task,Ant任务发送电子邮件-邮件类型不支持嵌套的“attachments”元素 我正在使用maven使用TestNG运行测试自动化脚本。我正在使用maven antrun插件发送附件中带有测试NG报告的电子邮件 不幸的是,我无法发送带有附件的电子邮件,并且错误为 嵌入错误:邮件>类型不支持嵌套的“附件”元素。 这是我的pom.xml <plugin> <artifactId>maven-antrun-plugin</artifactId

Ant任务发送电子邮件-邮件类型不支持嵌套的“attachments”元素

我正在使用maven使用TestNG运行测试自动化脚本。我正在使用maven antrun插件发送附件中带有测试NG报告的电子邮件

不幸的是,我无法发送带有附件的电子邮件,并且错误为

嵌入错误:邮件>类型不支持嵌套的“附件”元素。

这是我的pom.xml

     <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <configuration>
                        <tasks>
                            <mail
                                    tolist=""
                                    from=""
                                    subject="Report"
                                    mailhost=""
                                    mailport=""
                                    user=""
                                    password="">
                                <message>Please find the Attached automation report.
                                      Note: This is an automatic generated e-mail
                                </message>
                                <attachments>
                                    <fileset dir="target">
                                        <include name="**/*.html"/>
                                    </fileset>
                                </attachments>
                            </mail>
                           </tasks>
                    </configuration>
                    <phase>test</phase>
                    <id>SentEmail</id>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> 

maven antrun插件
1.1
请查看随附的自动化报告。
注意:这是一封自动生成的电子邮件
测试
发送电子邮件
跑

您需要将java激活框架和java邮件jar添加到您的 类路径。 它们不附带Ant或Java,可以下载

下载2个JAR,将它们添加到ant类路径中,它应该 干得好

顺便说一句,Ant文档已经在手册中介绍了这一点
Maven postman插件的页面对我来说很好。谢谢你的帮助

  <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>false</inherited>
                    <configuration>
                        <from>xxxxxxxx</from>
                        <subject>Regression Report</subject>
                        <failonerror>true</failonerror>
                        <mailhost>xxxxx</mailhost>
                        <mailport>xxx</mailport>
                        <mailuser>xxxxxx</mailuser>
                        <mailpassword>xxxxx</mailpassword>
                        <htmlMessage>Please find the Attached automation report.
                            Note: This is an automatic generated e-mail</htmlMessage>
                        <receivers>
                            <receiver>email@email.com</receiver>
                        </receivers>
                        <fileSets>
                            <fileSet>
                                <directory>${basedir}/target</directory>
                                <includes>
                                    <include>**/emailable-report.html</include>
                                   <!-- <include>**/*.zip</include> -->
                                </includes>
                            </fileSet>
                        </fileSets>
                    </configuration>
                </execution>
            </executions>
        </plugin>

福提西教堂
maven邮递员插件
寄信
测试
寄信
假的
xxxxxxxx
回归报告
真的
xxxxx
xxx
xxxxxx
xxxxx
请查看随附的自动化报告。
注意:这是一封自动生成的电子邮件
email@email.com
${basedir}/目标
**/emailable-report.html