1

我无法通过 ant build 发送电子邮件。我收到以下错误:

Buildfile: C:\Users\madhur\workspace\TCLAutomation\build.xml
build-subprojects:
init:
build-project:
     [echo] Hello Hi in build
     [echo] TCLAutomation: C:\Users\madhur\workspace\TCLAutomation\build.xml
    [javac] C:\Users\madhur\workspace\TCLAutomation\build.xml:32: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
build:
email-testng:
     [echo] ---------------------------
     [echo] SMTP Server..:  smtp.gmail.com
     [echo] Subject......:  TestNG Report for Date and time 18/December/2012 :(10:56:53)
     [echo] Message File.:  C:\Users\madhur\workspace\TCLAutomation\test-output\emailable-report.html
     [echo] From.........:  tcl.testng.reports@gmail.com
     [echo] To...........:  tcl.testng.reports@gmail.com
     [echo] ---------------------------
     [mail] Sending email: TestNG Report for Date and time 18/December/2012 :(10:56:53)
     [mail] Failed to send email: 530-5.5.1 Authentication Required. Learn more at
     [mail] 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 o11sm493273pby.8

BUILD FAILED
C:\Users\madhur\workspace\TCLAutomation\build.xml:132: Problem while sending mime mail:

Total time: 2 seconds

构建脚本

<target description="Email the testng style format report." name="email-testng" >
                        <property name="report.type" value="TestNG" />
                        <tstamp>
                            <format property="HUMANDATE" pattern="dd/MMMM/yyyy :(HH:mm:ss)" />
                        </tstamp>
                        <property name="subject" value="${report.type} Report for Date and time ${HUMANDATE}" />

                             <echo>---------------------------</echo>
                             <echo>SMTP Server..:  smtp.gmail.com</echo>
                             <echo>Subject......:  ${subject}</echo>
                             <echo>Message File.:  ${basedir}\test-output\emailable-report.html</echo>
                             <echo>From.........:  tcl.testng.reports@gmail.com</echo>
                             <echo>To...........:  tcl.testng.reports@gmail.com</echo>
                             <echo>---------------------------</echo>

                    <zip destfile="${basedir}/PictorialReports.zip" basedir="${basedir}/testng-xslt" update="true"/>
                    <zip destfile="${basedir}/FailedCasesScreenShots.zip" basedir="${basedir}/ScreenShots" update="true"/>  

                    <mail mailhost="smtp.gmail.com" mailport="465" password="xxxxxxx" ssl="true" subject="${subject}" user="tcl.testng.reports@gmail.com">
                       <from address="tcl.testng.reports@gmail.com"></from>
                         <replyto address="tcl.testng.reports@gmail.com"></replyto>
                         <to address="tcl.testng.reports@gmail.com"></to>

                         <message>This is auto generated mail after completion of test case execution.The Reports of test cases executed.Download the attachments and keep all attachemnts in same folder.Double click on emailable-reports.html for results of executed test cases. Double click on index.html to view them in pie chart model.
                         </message>

                          <attachments>
                             <fileset dir="${basedir}/test-output">
                                 <include name="emailable-report.html"></include>
                              </fileset>
                            <fileset dir="${basedir}">
                                 <include name="PictorialReports.zip"></include>
                            </fileset>
                            <fileset dir="${basedir}">
                                 <include name="FailedCasesScreenShots.zip"></include>
                            </fileset>
                             </attachments>  

                          </mail>
                        </target>

他们提供的链接没有帮助。我无法获得需要身份验证的问题。任何人都可以帮忙。谢谢。

4

0 回答 0