A Concourse CI resource to send emails.
-
from
: Required. The email address of the sender as a string. -
host
: Optional. The smtp host to send from.
Adding the resource to your project:
resource_types:
- name: email
type: docker-image
source:
repository: mdomke/concourse-email-resource
Resource configuration:
resources:
- name: send-email
type: email
source:
from: ci@example.com
host: smtp.example.com
Sending an email message:
- put: send-email
params:
to: [recipient@example.com]
subject: subject.txt
body: body.txt
check
and in
operations are a noop.
to|to_file
: (mandatory) Useto
to specify a list of recipients as strings or useto_file
to specify file with addresses, each address should be in a new line.subject|subject_text
: (mandatory) Usesubject
to specify a path to the file holding the email subject or usesubject_text
to specify a plain text subject.body|body_text
: (mandatory) Usebody
to specify a path to the file holding the email body or usebody_text
to specify a plain text email body.vars
: (optional) A path to a JSON-file holding template vars.type
: (optional) The MIME subtype (defaults to"html"
)inline_css
: (optional) Inline CSS to style attributes in HTML.attachments
: A list of file names that will be attached to the email. Attachments only work iftype
is"html"
, wildcards (*
) are supported, ex:your-attachment-*.zip
.
subject|subject_text
and body|body_text
can both either be plain text, html or a jinja-template.
In the latter case you can specify an additional file (vars
) for holding template variables that should
be rendered into the template. Additionally to the variables from the vars
-file, all environment variables can
be used in the template (e.g.: BUILD_ID
). By default (if the MIME subtype is "html"), the CSS styles will be
inlined to the HTML. If you don't want that, you can set the inline_css
parameter to False
.
If you want to use jinja-template in subject_text
or body_text
you need to define the content as a multiline text, otherwise a syntax error will be reported for malformed yaml.
- put: send-email
params:
to: [recipient@example.com]
subject_text: |
{% block BUILD_PIPELINE_NAME %}{% endblock %}:{% block BUILD_JOB_NAME %}{% endblock %} failed
body_text: |
{% block BUILD_PIPELINE_NAME %}{% endblock %}:{% block BUILD_JOB_NAME %}{% endblock %} failed
A more elaborate usage example would look like this:
- put: send-email
params:
to: [recipient@example.com]
subject: subject
body: body.html
vars: vars.json
or for a plain text example:
- put: send-email
params:
to: [recipient@example.com]
subject: subject.txt
body: body.txt
type: plain