After ant uploads svn, automatically send emails

Yesterday, I wrote an automatic package and submitted it to svn. Later, I felt that after each submission, I had to send an email to notify everyone, which was very troublesome, so I thought of the email sending function of ant.

Let me introduce it here

To use the email function, you need to put  activation.jar and mail.jar into ant\lib

Then define it in properties

 

email.host=smtp.XXX.com
##Email port does not need to be set by default (you can not)
email.port=25
##Email subject Don't write Chinese here, if you write Chinese, you need to use the native2ascii tool that comes with jdk to transcode
email.subject=XXX published
##Email from shows where the email is sent from
[email protected]
##Email to You can write multiple here, separated by commas
[email protected],[email protected] ...

 

<mail mailhost="${email.host}" mailport="${email.port}" subject="${email.subject}"
      from="${email.from}" tolist="${email.to}"
      encoding="mime" messagemimetype="text/html" >
  <!--
    The receiving email address can also be written in the following way, but only one address can be written at a time, but multiple addresses can be written
     <to-address="[email protected]"/>
     <to-address="..."/>
   -->
   <message>Your message here</message>
     <!--
      Here you don't need to write dead message, you can use messagefile to get the content from the file
     messagefile="./src/test/ant/message_content.txt"
-->
   <!--
    Attachments can be placed here, no need to fill in, you can use relative paths or absolute paths, and support wildcards
    <attachments>
        <fileset dir=".">
           <include name="1.xls"/>
           ... can hold multiple
        </fileset>
    </attachments>
-->
</mail>

 Description of common properties: 

 1. The address of the mailhost mail
 server2. The port of  the  mailport
 mail   
 server Sub-tags replace  7, message mail content One or more <message> sub-tags replace  8, messagefile file list file content will be used as mail content, one or more <message> sub-tags replace  9, messagemimetype mail type, the default is filset attachment list multiple attachments are separated by commas or spaces and replace with <fileset > subtag Whether to use TLS/SSL




text/plain
10、







 Subtags of mail label 
 (1) to/cc/bcc/from/replyto 
     attribute 
          name display name
          address list of mail addresses

  (2) message content is marked mail content
      attribute
         src file list as file content
         mime mime type
         charset character set   (3 ) fileset        attribute dir directory can set an absolute path or a relative path       subtag include attribute name specifies the file to be included supports wildcards
  


 

There is a problem:

1. If the attachment is a Chinese name, it will display garbled characters, but it is normal to open it

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326939923&siteId=291194637