A Concourse CI resource to send emails.
from: Required. The email address of the sender as a string.
Adding the resource to your project:
resource_types:
- name: email
type: docker-image
source:
repository: mdomke/concourse-email-resourceResource configuration:
resources:
- name: send-email
type: email
source:
from: [email protected]Sending an email message:
- put: send-email
params:
to: [[email protected]]
subject: subject.txt
body: body.txtcheck and in operations are a noop.
to|to_file: (mandatory) Usetoto specify a list of recipients as strings or useto_fileto specify file with addresses, each address should be in a new line.subject|subject_text: (mandatory) Usesubjectto specify a path to the file holding the email subject or usesubject_textto specify a plain text subject.body|body_text: (mandatory) Usebodyto specify a path to the file holding the email body or usebody_textto 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 iftypeis"html".
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: [[email protected]]
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 %} failedA more elaborate usage example would look like this:
- put: send-email
params:
to: [[email protected]]
subject: subject
body: body.html
vars: vars.jsonor for a plain text example:
- put: send-email
params:
to: [[email protected]]
subject: subject.txt
body: body.txt
type: plain