%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/smtp.pyc

�
���^c	@@s�dZddlmZmZmZddlZddlZddlZddlZ	ej
e�Ze
Zy:ddlZddlZddlZddlZeZWnek
r�nXdZd�Zddddddddd�ZdS(	u�
Module for Sending Messages via SMTP

.. versionadded:: 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:

    .. code-block:: yaml

        my-smtp-login:
            smtp.server: smtp.domain.com
            smtp.tls: True
            smtp.sender: admin@domain.com
            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:

    .. code-block:: yaml

        my-smtp-login:
            smtp.server: smtp.domain.com
            smtp.tls: True
            smtp.sender: admin@domain.com
            smtp.username: myuser
            smtp.password: verybadpass

        another-smtp-login:
            smtp.server: smtp.domain.com
            smtp.tls: True
            smtp.sender: admin@domain.com
            smtp.username: myuser
            smtp.password: verybadpass

i(tabsolute_importtunicode_literalstprint_functionNusmtpcC@str
tStdfS(uG
    Only load this module if smtplib is available on this minion.
    u2This module is only loaded if smtplib is available(tHAS_LIBSt__virtualname__tFalse(((s5/usr/lib/python2.7/site-packages/salt/modules/smtp.pyt__virtual__DsuMessage from SaltuTruec

C@s�|rdtd|�}
|
jd�}|
jd�}|
jd�}|
jd�}|
jd�}n|	r�tjjj�}|jtjjj|��ntjjj|�}||d<||d<||d	<g|j	d
�D]}|j
�^q�}
y1|dkrtj|�}ntj
|�}Wn'tjk
rP}tjd
|�tSX|dkr�|j�|jd�r�y|j�Wnatjk
r�tjd�tStjk
r�tjd�tStk
r�tjd�tSX|j�q�n|rB|rBy|j||�WqBtjk
r>}tjd�tSXn|	r�x�|	D]z}tjj|�}tjj j!|d��(}tjj"j#|j$�d|�}WdQXdj%|�|d<|j|�qOWny|j&||
|j'��Wn�tj(k
rtjd�tStjk
r2tjd�tStj)k
rVtjd|�tStj*k
rwtjd�tSX|j+�t,S(u`
    Send a message to an SMTP recipient. Designed for use in states.

    CLI Examples:

    .. code-block:: bash

        salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' profile='my-smtp-account'
        salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' username='myuser' password='verybadpass' sender='admin@example.com' server='smtp.domain.com'
        salt '*' smtp.send_msg 'admin@example.com' 'This is a salt module test' username='myuser' password='verybadpass' sender='admin@example.com' server='smtp.domain.com' attachments="['/var/log/messages']"
    u
config.optionusmtp.serverusmtp.tlsusmtp.senderu
smtp.usernameu
smtp.passworduSubjectuFromuTou,uTrueutrueu
Exception: %suSTARTTLSuPThe server didn’t reply properly                         to the HELO greeting.u3The server does not support the STARTTLS extension.uTSSL/TLS support is not available                         to your Python interpreter.uSMTP Authentication FailureurbtNameNuattachment; filename="{0}"uContent-DispositionuAll recipients were refused.u8The server didn’t reply properly to the HELO greeting.u"The server didn’t accept the %s.u1The server replied with an unexpected error code.(uTrueutrue(uTrueutrue(-t__salt__tgettemailtmimet	multipartt
MIMEMultiparttattachttexttMIMETexttsplittstriptsmtplibtSMTP_SSLtSMTPtsockettgaierrortlogtdebugRtehlothas_extntstarttlst
SMTPHeloErrort
SMTPExceptiontRuntimeErrortlogintSMTPAuthenticationErrortostpathtbasenametsalttutilstfilestfopentapplicationtMIMEApplicationtreadtformattsendmailt	as_stringtSMTPRecipientsRefusedtSMTPSenderRefusedt
SMTPDataErrortquittTrue(t	recipienttmessagetsubjecttsendertservertuse_ssltusernametpasswordtprofiletattachmentstcredstmsgtrt
recipientstsmtpconnt_errortftnametfintatt((s5/usr/lib/python2.7/site-packages/salt/modules/smtp.pytsend_msgMs�


(




'



(t__doc__t
__future__RRRtloggingR"Rtsalt.utils.filesR%t	getLoggert__name__RRRRtemail.mime.textR
temail.mime.applicationtemail.mime.multipartR3tImportErrorRRtNoneRH(((s5/usr/lib/python2.7/site-packages/salt/modules/smtp.pyt<module>*s2

	

Zerion Mini Shell 1.0