You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mail.html 6.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Mail Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="mail">Mail</a></h2>
  8. <h3>Description</h3>
  9. <p>A task to send SMTP email. This task can send mail using either plain
  10. text, UU encoding, or MIME format mail, depending on what is available.
  11. Attachments may be sent using nested
  12. <a href="../CoreTypes/fileset.html">fileset</a> elements.</p>
  13. <p><strong>Note:</strong> This task may depend on external libraries
  14. that are not included
  15. in the Ant distribution. See <a href="../install.html#librarydependencies">
  16. Library Dependencies</a> for more information.
  17. </p>
  18. <h3>Parameters</h3>
  19. <table border="1" cellpadding="2" cellspacing="0">
  20. <tr>
  21. <td valign="top"><b>Attribute</b></td>
  22. <td valign="top"><b>Description</b></td>
  23. <td align="center" valign="top"><b>Required</b></td>
  24. </tr>
  25. <tr>
  26. <td valign="top">from</td>
  27. <td valign="top">Email address of sender.</td>
  28. <td align="center" valign="top">Either a <code>from</code> attribute, or a <code>&lt;from&gt;</code>
  29. element.</td>
  30. </tr>
  31. <tr>
  32. <td valign="top">tolist</td>
  33. <td valign="top">Comma-separated list of recipients.</td>
  34. <td align="center" valign="middle" rowspan="3">At least one of these, or the
  35. equivalent elements.</td>
  36. </tr>
  37. <tr>
  38. <td valign="top">cclist</td>
  39. <td valign="top">Comma-separated list of recipients to carbon copy</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">bcclist</td>
  43. <td valign="top">Comma-separated list of recipients to carbon copy</td>
  44. </tr>
  45. <tr>
  46. <td valign="top">message</td>
  47. <td valign="top">Message to send in the body of the email.</td>
  48. <td align="center" valign="middle" rowspan="2">One of these or a
  49. <code>&lt;message&gt;</code> element.</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">messagefile</td>
  53. <td valign="top">File to send as the body of the email. Property
  54. values in the file will be expanded.</td>
  55. </tr>
  56. <td valign="top">messagemimetype</td>
  57. <td valign="top">The content type of the message. The default is
  58. <code>text/plain</code>.</td>
  59. <td align="center" valign="top">No</td>
  60. </tr>
  61. <tr>
  62. <td valign="top">files</td>
  63. <td valign="top">Files to send as attachments to the email. Separate multiple
  64. file names using a comma. You can also use <code>&lt;fileset&gt;</code>
  65. elements to specify files.</td>
  66. <td align="center" valign="top">No</td>
  67. </tr>
  68. <tr>
  69. <td valign="top">failonerror</td>
  70. <td valign="top">flag to indicate whether to halt the build on
  71. any error. The default value is <code>true</code>.</td>
  72. <td align="center" valign="top">No.</td>
  73. </tr>
  74. <tr>
  75. <td valign="top">includefilenames</td>
  76. <td valign="top">Include filename(s) before file contents.
  77. Valid only when the <code>plain</code> encoding is used. The default
  78. value is <code>false</code>.</td>
  79. <td align="center" valign="top">No</td>
  80. </tr>
  81. <tr>
  82. <td valign="top">mailhost</td>
  83. <td valign="top">Host name of the SMTP server. The default value is
  84. <code>localhost</code>.</td>
  85. <td align="center" valign="top">No</td>
  86. </tr>
  87. <tr>
  88. <td valign="top">mailport</td>
  89. <td valign="top">TCP port of the SMTP server. The default value is 25.</td>
  90. <td align="center" valign="top">No</td>
  91. </tr>
  92. <tr>
  93. <td valign="top">encoding</td>
  94. <td valign="top">Specifies the encoding to use for the content of the email.
  95. Values are <code>mime</code>, <code>uu</code>, <code>plain</code>, or
  96. <code>auto</code>. The default value is <code>auto</code>.</td>
  97. <td align="center" valign="top">No</td>
  98. </tr>
  99. <tr>
  100. <td valign="top">subject</td>
  101. <td valign="top">Email subject line.</td>
  102. <td align="center" valign="top">No</td>
  103. </tr>
  104. </table>
  105. <h3>Parameters specified as nested elements</h3>
  106. <h4>to / cc / bcc / from</h4>
  107. <p>Adds an email address element. It takes the following attributes:</p>
  108. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  109. <tr>
  110. <td valign="top"><b>Attribute</b></td>
  111. <td valign="top"><b>Description</b></td>
  112. <td align="center" valign="top"><b>Required</b></td>
  113. </tr>
  114. <tr>
  115. <td valign="top">name</td>
  116. <td valign="top">The display name for the address.</td>
  117. <td align="center" valign="top">No</td>
  118. </tr>
  119. <tr>
  120. <td valign="top">address</td>
  121. <td valign="top">The email address.</td>
  122. <td align="center" valign="top">Yes</td>
  123. </tr>
  124. </table>
  125. <h4>message</h4>
  126. <p>Specifies the message to include in the email body. It takes the following
  127. attributes:</p>
  128. <table width="60%" border="1" cellpadding="2" cellspacing="0">
  129. <tr>
  130. <td valign="top"><b>Attribute</b></td>
  131. <td valign="top"><b>Description</b></td>
  132. <td align="center" valign="top"><b>Required</b></td>
  133. </tr>
  134. <tr>
  135. <td valign="top">src</td>
  136. <td valign="top">The file to use as the message.</td>
  137. <td align="center" valign="top">No</td>
  138. </tr>
  139. <tr>
  140. <td valign="top">mimetype</td>
  141. <td valign="top">The content type to use for the message.</td>
  142. <td align="center" valign="top">No</td>
  143. </tr>
  144. </table>
  145. <p>If the <code>src</code> attribute is not specified, then text can be added
  146. inside the <code>&lt;message&gt;</code> element. Property expansion will occur
  147. in the message, whether it is specified as an external file or as text within
  148. the <code>&lt;message&gt;</code> element.</p>
  149. <h3>Examples</h3>
  150. <blockquote><pre>
  151. &lt;mail from=&quot;me&quot;
  152. tolist=&quot;you&quot;
  153. subject=&quot;Results of nightly build&quot;
  154. files=&quot;build.log&quot;/&gt;
  155. </pre></blockquote>
  156. <p>Sends an email from <i>me</i> to <i>you</i> with a subject of
  157. <i>Results of nightly build</i> and includes the contents of the file
  158. <i>build.log</i> in the body of the message.</p>
  159. <blockquote><pre>
  160. &lt;mail mailhost=&quot;smtp.myisp.com&quot; mailport=&quot;1025&quot; subject=&quot;Test build&quot;&gt;
  161. &lt;from address=&quot;me@myisp.com&quot;&gt;
  162. &lt;to address=&quot;all@xyz.com&quot;&gt;
  163. &lt;message&gt;The ${buildname} nightly build has completed&lt;/message&gt;
  164. &lt;fileset dir=&quot;dist&quot;&gt;
  165. &lt;includes name=&quot;**/*.zip&quot;/&gt;
  166. &lt;/fileset&gt;
  167. &lt;/mail&gt;
  168. </pre></blockquote>
  169. <p>Sends an eMail from <i>me@myisp.com</i> to <i>all@xyz.com</i> with a subject of
  170. <i>Test Build</i> and attaches any zip files from the dist directory.&nbsp; The
  171. task will attempt to use JavaMail and fall back to UU encoding or no encoding in
  172. that order depending on what support classes are available. <code>${buildname}</code>
  173. will be replaced with the <code>buildname</code> property's value.</p>
  174. <hr>
  175. <p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All rights
  176. Reserved.</p>
  177. </body>
  178. </html>