salt.modules.smtp
Module for Sending Messages via SMTP
New in version 2014.7.0.
- depends
-
smtplib python module
- configuration
-
This module can be used by either passing a jid and password directly to send_message, or by specifying the name of a configuration profile in the minion config, minion pillar, or master config.
For example:
my-smtp-login: smtp.server: smtp.domain.com smtp.tls: True smtp.sender: [email protected] smtp.username: myuser smtp.password: verybadpass
The resourcename refers to the resource that is using this account. It is user-definable, and optional. The following configurations are both valid:
my-smtp-login: smtp.server: smtp.domain.com smtp.tls: True smtp.sender: [email protected] smtp.username: myuser smtp.password: verybadpass another-smtp-login: smtp.server: smtp.domain.com smtp.tls: True smtp.sender: [email protected] smtp.username: myuser smtp.password: verybadpass
-
Send a message to an SMTP recipient. To send a message to multiple recipients, the recipients should be in a comma-seperated Python string. Designed for use in states.
CLI Examples:
salt '*' smtp.send_msg '[email protected]' 'This is a salt module test' profile='my-smtp-account' salt '*' smtp.send_msg '[email protected],[email protected]' 'This is a salt module test for multiple recipients' profile='my-smtp-account' salt '*' smtp.send_msg '[email protected]' 'This is a salt module test' username='myuser' password='verybadpass' sender='[email protected]' server='smtp.domain.com' salt '*' smtp.send_msg '[email protected]' 'This is a salt module test' username='myuser' password='verybadpass' sender='[email protected]' server='smtp.domain.com' attachments="['/var/log/messages']"
salt.modules.smtp.send_msg(recipient, message, subject='Message from Salt', sender=None, server=None, use_ssl='True', username=None, password=None, profile=None, attachments=None)
© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.smtp.html