From Evgeny Goldin

(Redirected from Maven-mail-plugin)
Jump to: navigation, search



There are situation when we need e-mails to be sent as result of our build process. While CI servers like Hudson already send e-mails with jobs status, occasionally, we may need something more. We may want to get a detailed results of our integration tests by mail. Or some special kind of compilation or build process to be sent to another group. Something that is more detailed and much more informative than a simple "Build passed/failed" message from a CI server.

This plugin allows you to send emails from Maven via SMTP server:

                <subject>This is subject</subject>
                <text>And this is body</text>


Provided By
Mailing List Nabble
Source Code GitHub
GroovyDoc <groovydoc>
Issue Tracker YouTrack
Build Server Maven
Maven Coordinates
  • com.github.goldin:mail-maven-plugin:0.2.5
  • send
Default Phase
  • install
Maven Repository Artifactory Online


<runIf> Optional. Specifies if plugin needs to be run, see "copy-maven-plugin" documentation for more details
<smtp> Specifies your SMTP server, assumes there's no SMTP Authentication
<from> Specifies your "From" address
<mails> Specifies addresses to send e-mails to. <to>, <cc>, and <bcc> nested tags are supported




;-separated list of "To", "Cc", and "Bcc" addresses.

Full names can be specified as "Name &lt;mail@address&gt;":

    FirstName SecondName &lt;some@email&gt;;
    FirstName SecondName &lt;;;
    FirstName SecondName &lt;some@email&gt;;
    FirstName SecondName &lt;;;
<subject> Specifies message subject, empty by default
<text> Specifies message body, empty by default
<textFile> Specifies message body as a text file, appended to <body>:
<files> Specifies files to attach to the message:

Dynamic content: <subject>, <text>

It is easy to send e-mails with static <subject> or <text> known in advance. But what if they dynamic and depend on previous steps? In this case we need to create a corresponding Maven properties before "mail-maven-plugin" is run and make it use them:


The idea of creating new properties dynamically is borrowed from Ant where lot's of its tasks create new Ant properties as a result of their run. Those new properties are later used for different purposes.

Same idea applies here:

  1. You run something that creates new Maven properties. It can be done with "properties-maven-plugin".
  2. You run "mail-maven-plugin" that uses those properties.

Dynamic content: <textFile>, <files>

For <textFile> and <files> you may use files whose content is created dynamically by attaching a file like "${}/status.txt" and making sure it contains the relevant content when "mail-maven-plugin" is run. Right now it is not possible to alter <files> list dynamically.

Personal tools