我正在使用此ant脚本发送电子邮件:
<target name="install-jars" description="Install ANT optional jars">
<mkdir dir="${user.home}/.ant/lib" />
<get dest="${user.home}/.ant/lib/mail.jar"
src="http://search.maven.org/remotecontent?filepath=javax/mail/mail/1.4.4/mail-1.4.4.jar" />
<get dest="${user.home}/.ant/lib/activation.jar"
src="http://search.maven.org/remotecontent?filepath=javax/activation/activation/1.1/activation-1.1.jar" />
</target>
<tstamp>
<format property="TODAY_US" pattern="dd-MM-yyyy" locale="en,IL" />
</tstamp>
<copy todir="T:/Ali/backup/reports/AutoAccess_337/${TODAY_US}">
<fileset dir="log/current" />
</copy>
<target name="notify" description="notify team">
<mail mailhost="SRVSMTP" subject="latest deployment">
<from address="ali.t@ab.com" />
<to address="ali.t@ab.coml" />
<message>A new build has been pushed out to prod</message>
</mail>
</target>
由于某种原因未发送邮件,没有任何错误消息, 任何建议。
答案 0 :(得分:0)
深入调查问题后: 我在ant lib目录中添加了两个jar文件,在我的情况下,因为我正在从eclipse执行ant,我通过导航到:(Window&gt;&gt; Preferences&gt;&gt; Ant&gt;&gt; RunTime&gt)检查了ant home值;&gt; Classpath&gt;&gt; Ant Home Entries)。 之后,我将mail.jar和Activation.jar文件添加到Ant主目录下的lib目录中。 这解决了这个问题。
BR, 阿里