mail

Collection: community.general

Full Name: parallax.community.general.mail

Aliases: community.general.mail, mail

Synopsis

Send an email from the playbook

Parameters

NameTypeRequiredDefaultDescription
hoststringlocalhostSMTP server hostname
portint25SMTP server port
tostringyesRecipient email address(es), comma-separated
ccstringCC email address(es), comma-separated
bccstringBCC email address(es), comma-separated
subjectstringyesEmail subject line
bodystringEmail body content
fromstringrootSender email address
securestringtrySecurity mode (always, never, try, starttls)
usernamestringSMTP authentication username
passwordstringSMTP authentication password
headersstringAdditional email headers as key=value pairs
charsetstringutf-8Character set for the email
subtypestringplainMIME subtype (plain, html)
timeoutint20SMTP connection timeout in seconds
attachstringFile path(s) to attach, comma-separated

Example

- name: Notify the on-call address that the deploy finished
  mail:
    host: smtp.example.com
    port: 587
    to: oncall@example.com
    subject: "Deploy of {{ app_version }} complete"
    body: "{{ inventory_hostname }} finished without errors."
    from: parallax@example.com