golden hour
/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/__pycache__
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.cpython-311.pyc
1.54 KB
Del
OK
clcagefs.cpython-311.pyc
15.5 KB
Del
OK
clcaptain.cpython-311.pyc
4.31 KB
Del
OK
clconfig.cpython-311.pyc
3.19 KB
Del
OK
clconfpars.cpython-311.pyc
16.37 KB
Del
OK
clcustomscript.cpython-311.pyc
1.85 KB
Del
OK
cldebug.cpython-311.pyc
1.29 KB
Del
OK
clemail.cpython-311.pyc
2.42 KB
Del
OK
clexception.cpython-311.pyc
1.7 KB
Del
OK
clfunc.cpython-311.pyc
11.95 KB
Del
OK
clhook.cpython-311.pyc
6.16 KB
Del
OK
cllog.cpython-311.pyc
2.78 KB
Del
OK
cloutput.cpython-311.pyc
846 B
Del
OK
clproc.cpython-311.pyc
8.93 KB
Del
OK
clpwd.cpython-311.pyc
11.97 KB
Del
OK
clquota.cpython-311.pyc
1.79 KB
Del
OK
clsec.cpython-311.pyc
1.55 KB
Del
OK
clwpos_lib.cpython-311.pyc
20.95 KB
Del
OK
const.cpython-311.pyc
293 B
Del
OK
evr_utils.cpython-311.pyc
5.06 KB
Del
OK
features.cpython-311.pyc
6.08 KB
Del
OK
group_info_reader.cpython-311.pyc
6.46 KB
Del
OK
lock.cpython-311.pyc
1.97 KB
Del
OK
mail_helper.cpython-311.pyc
7.2 KB
Del
OK
mysql_lib.cpython-311.pyc
10.01 KB
Del
OK
php_conf_reader.cpython-311.pyc
11.29 KB
Del
OK
sysctl.cpython-311.pyc
10.42 KB
Del
OK
ui_config.cpython-311.pyc
4.69 KB
Del
OK
utils.cpython-311.pyc
40.28 KB
Del
OK
utils_cmd.cpython-311.pyc
4.19 KB
Del
OK
Edit: mail_helper.cpython-311.pyc
� ��i� � � � d dl Zd dlZd dlZd dlZd dlZd dlmZm Z d dl mZ d dlm Z d dlmZ dZ G d� de� � Z G d � d � � ZdS )� N)�base� multipart)� SysLogHandler)�Optional)�errorzAleksandr Shyshatskyc � � e Zd ZdS )�MailSendFailedN)�__name__� __module__�__qualname__� � �t/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/mail_helper.pyr r s � � � � � ��Dr r c � � e Zd ZdZd� Zddej dee fd�Z ddee fd�Z dedej fd �Z ddee fd �ZdS )� MailHelperz6Common class to send emails via local smtp or sendmailc �� � t j j s�t j � d� � r�t dt j �� � }t j � |� � t j d�� � }|� |� � |� t j � � nt j � � t j � � | _ d S )Nz/dev/log)�address�facilityz3mail_helper: (%(name)s) [%(levelname)s] %(message)s)�fmt)�logging�root�handlers�os�path�existsr � LOG_DAEMON� addHandler� Formatter�setFormatter�setLevel�ERROR�basicConfig� getLogger�_log)�self�SYS_LOG� formatter_syss r �__init__zMailHelper.__init__ s� � ��|�$� &��w�~�~�j�)�)� &�'� �]�E]�^�^�^����'�'��0�0�0� '� 1�6k� l� l� l� ��$�$�]�3�3�3�� � ���/�/�/�/��#�%�%�%��%�'�'�� � � r N�msg� encoding_namec �& � |r(|� � � � |� � }n|� � � }g d�}t j |t j t j t j d�� � 5 }|� |� � d }|j dk rt j |j ||� � � ddd� � dS # 1 swxY w Y dS # t t j f$ r"}t t |� � � � |�d}~ww xY w)z� Alternative function that should be called when we cannot send email via smtp :type msg: email.mime.base.MIMEBase :type encoding_name: encoding name to encode message text )z/usr/sbin/sendmailz-tz-oiT)�stdin�stdout�stderr�textr N)� as_string�encode� subprocess�Popen�PIPE�communicate� returncode�CalledProcessError�OSErrorr �str)r% r) r* � s_message�cmd�procr- �exs r �_sendmail_consolezMailHelper._sendmail_console* sh � � 2�� ,��M�M�O�O�2�2�=�A�A� � ��M�M�O�O� �5�5�5�C��!�� �o�!��!���� � � V� ��)�)�)�4�4�Q�7���?�a�'�'�$�7����f�U�U�U� (� V� V� V� V� V� V� V� V� V� V� V� V���� V� V� V� V� V� V�� ��6�7� 2� 2� 2� ��R���)�)�r�1����� 2���s= �A9C �;AC�>C �C�C �C�C �D�.D�Dc �x � t j d� � }|r(|� � � � |� � }n|� � � }|� |||� � |� � � dS # t j t f$ r"}t t |� � � � |�d}~ww xY w)z� Send email using smtp protocol; :type from_addr: str :type to_addrs: List[str] :type msg: email.mime.base.MIMEBase :type encoding_name: encoding name to encode message text � localhostN) �smtplib�SMTPr0 r1 �sendmail�quit� SMTPException�socketerrorr r9 )r% � from_addr�to_addrsr) r* � smtp_instancer: r= s r �_sendmail_smtpzMailHelper._sendmail_smtpE s� � � 2�#�L��5�5�M�� ,��M�M�O�O�2�2�=�A�A� � ��M�M�O�O� ��"�"�9�h� �B�B�B���� � � � � ���%�{�3� 2� 2� 2� ��R���)�)�r�1����� 2���s �A=B �B9�B4�4B9rG c �� � |d s_t j � |� d� � d �� � |d<