Send out emails using the Mandrill API.
In the minion configuration file, the following block is required:
mandrill:
key: <API_KEY>
New in version 2018.3.0.
salt.modules.mandrill.
send
(message, asynchronous=False, ip_pool=None, send_at=None, api_url=None, api_version=None, api_key=None, **kwargs)¶Send out the email using the details from the message
argument.
The information on the message to send. This argument must be sent as dictionary with at fields as specified in the Mandrill API documentation.
False
Enable a background sending mode that is optimized for bulk sending. In asynchronous mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in asynchronous mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of asynchronous.
The name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.
When this message should be sent as a UTC timestamp in
YYYY-MM-DD HH:MM:SS
format. If you specify a time in the past,
the message will be sent immediately. An additional fee applies for
scheduled email, and this feature is only available to accounts with a
positive balance.
Note
Fur further details please consult the API documentation.
CLI Example:
$ salt '*' mandrill.send message="{'subject': 'Hi', 'from_email': 'test@example.com', 'to': [{'email': 'recv@example.com', 'type': 'to'}]}"
message
structure example (as YAML for readability):
message:
text: |
This is the body of the email.
This is the second line.
subject: Email subject
from_name: Test At Example Dot Com
from_email: test@example.com
to:
- email: recv@example.com
type: to
name: Recv At Example Dot Com
- email: cc@example.com
type: cc
name: CC At Example Dot Com
important: true
track_clicks: true
track_opens: true
attachments:
- type: text/x-yaml
name: yaml_file.yml
content: aV9hbV9zdXBlcl9jdXJpb3VzOiB0cnVl
Output example:
minion:
----------
comment:
out:
|_
----------
_id:
c4353540a3c123eca112bbdd704ab6
email:
recv@example.com
reject_reason:
None
status:
sent
result:
True