Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/setroubleshoot/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/setroubleshoot/__pycache__/email_alert.cpython-36.pyc

3

�h>`�
�@s�ddlmZdgZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
Tejd	�Zd
d�Zdd�Zed
kr�edd�dS)�)�absolute_import�email_alertN)�MIMEText)�
MIMEMultipart)�
formatdate)�
get_config)�*z ^\s*([^@ \t]+)(@([^@ \t]+))?\s*$cCs2tj|�}d}d}|r*|jd�}|jd�}||fS)N��)�
email_addr_re�search�group)Zaddr�match�userZdomain�r�!/usr/lib/python3.6/email_alert.py�parse_email_addr$s


rcCsPtdd�}tddt�}tdd�}t|�\}}|dkr8d}|dkrFt�}d||f}td||dj|�f�|j�|j|j��}d	tdd
�|f}|j	�|j
�}	td�}
||
d<||
d
<dj|�|
d<t�|
d<|
j
t|	��ddl}y*|j||�}|j|||
j��|j�Wn8|jk
�rJ}
ztjtjd|
�WYdd}
~
XnXdS)NZemail�	smtp_host�	smtp_port�from_addressZSELinuxTroubleshootz%s@%szalert smtp=%s:%d  -> %s�,z[%s] %s�subject�alternativeZSubjectZFromz, ZToZDaterzemail failed: %s)r�intrZget_hostnameZ	log_debug�joinZ%update_derived_template_substitutionsZ
substitute�summaryZformat_textZformat_detailsrrZattachr�smtplibZSMTPZsendmailZ	as_string�quitZ
SMTPException�syslogZLOG_ERR)ZsiginfoZto_addrsrrrZ	from_userZfrom_domainrr�textZ	email_msgrZsmtp�errrr.s6


�__main__zThis is the sigzThis is the solution)Z
__future__r�__all__r�reZemail.mime.textrZemail.mime.multipartrZemail.utilsrZsetroubleshoot.configrZsetroubleshoot.util�compilerrr�__name__rrrr�<module>s

%

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists