如何在 HTML 正文部分以纯文本形式发送邮件 在 Ant 邮件任务的帮助下

how to send mail in plain text in HTML Body section with the help of Ant Mail Task

本文关键字:Ant 帮助 任务 正文部 HTML 文本      更新时间:2023-09-26

我正在使用 Ant 邮件任务发送一封构建状态的电子邮件。

<target name="htmllink">
<exec executable="svn" outputproperty="**svnlog**">
      <arg line="log -r ${bottom_rev}:${top_rev} -v svn://172.16.143.200/Repository/branches/${project.svn.url}/${build_tech} --username ${svn.username} --password ${svn.username}" />
</exec> 
<mail from="AutoDeploy@amphorainc.com"
              messagemimetype="text/html"
              tolist="pkumar@amphorainc.com"
              cclist="pkumar@amphorainc.com"
              bcclist="pkumar@amphorainc.com"
              subject="BUILD SCRIPT AUTOMATED MAIL FOR ${patch.name}"
              mailhost="172.16.143.41"
              charset="ISO-8859-1">  <!-- local SMTP mailhost IP -->
<message src="OC.html" />
</mail>
</target>`
here i am using OC.html message source page for mailing contents like below
`<html>
<head>
<STYLE TYPE="text/css">
td{font-family: Calibri; font-size: 12pt;}
.color {color:black;font-size:10pt;display : block;line-height:16px; text-align : center;background-color:#D4AEBB; border:outset 3px #DB7093;text-decoration:none;width:50%;}  
.color:HOVER {color:red;font-size:10pt;display : block; line-height:16px;text-align : center;background-color : #F0DEE5; border :inset 3px #CC3366;text-decoration:none;width:50%;}
</STYLE>
</head>
<body onload="wrapLines(30, ${svnlog})">
<a class="color" href="http://172.16.170.113/dashboard/Patch_details.aspx?patch_name=${patch.name}&branch_name=${project.svn.url}" rel="Does not exist">BDT Report</a></br>
BR#${BR.number}</br>
The build is completed and available at FTP site.</br>
</br>
Objective-C patch</br>
*******************************************************************************</br>
Patch Name      :  ${patch.name}</br>
Revision Number :  ${bottom_rev} to ${top_rev}</br>
FTP Location    :  ${ftp.location}/${patch.name}.tar.gz</br>
*******************************************************************************</br>
SVN Log Info</br>
************</br>
**${svnlog}**</br></br>
</body>
</html>

在正文部分,我正在打印 ant 变量 ${svnlog},它是一堆代码签入描述行。所以这里它是在一长行中打印所有行,而不是在单独的行中。

我怎样才能在单独的行中得到这个?

<body onload="wrapLines(30, ${svnlog})">
<pre>
<a class="color" href="http://172.16.170.113/dashboard/Patch_details.aspx?patch_name=${patch.name}&branch_name=${project.svn.url}" rel="Does not exist">BDT Report</a></br>
BR#${BR.number}</br>
The build is completed and available at FTP site.</br>
</br>
Objective-C patch</br>
*******************************************************************************</br>
Patch Name      :  ${patch.name}</br>
Revision Number :  ${bottom_rev} to ${top_rev}</br>
FTP Location    :  ${ftp.location}/${patch.name}.tar.gz</br>
*******************************************************************************</br>
SVN Log Info</br>
************</br>
**${svnlog}**</br></br>
</body>
</pre>