| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/payroll/threadings/__pycache__/ |
Upload File : |
o
hͦh5
� @ s~ d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
dd lmZ e�e�ZG d
d� de�ZdS )z9
mail.py
This module is used handle mail sent in thread
� N)�Thread)�EmailMessage)�render_to_string)�ConfiguredEmailBackend)�EmployeeWorkInformation)�Payslip)�payslip_pdfc s* e Zd ZdZdd� Zd� fdd�Z� ZS ) �MailSendThreadz
MailSend
c C sB t �| � || _|| _|| _|�� | _|�� rd| _d S d| _d S )N�https�http) r �__init__�result_dict�ids�request�get_host�host� is_secure�protocol)�selfr r
r � r �'/var/www/erp/payroll/threadings/mail.pyr s
zMailSendThread.__init__�returnNc sZ t � �� t| j�� �D ]�}td|| j| jd��}g }|d D ]}t| j |j
�}|�|�� � d�|j
df� q|d d j}t� }|j}| j rdz| j jj�� � d| j jjj� d�}W n t�t� Y td |d d �� � d
�|||�� g|gd�} || _d| _z| �� tjj | j!d
�j"dd� W q ty� }
zt�#|
� W Y d }
~
qd }
~
ww d S )Nz#payroll/mail_templates/default.html)�recordr r � instancesz.pdfzapplication/pdfr z <�>zHello, z Your Payslips is Ready!)�reply_to�html)�id__inT)�sent_to_employee)$�super�run�listr
�valuesr r r r r �id�append�get_payslip_title�content�employee_idr �$dynamic_from_email_with_display_name�user�employee_get�
get_full_name�email�logger�error� Exceptionr �get_name�get_mail�attachments�content_subtype�sendr �objects�filterr �update� exception)r r �html_messager2 �instance�response�employee�
email_backend�display_email_namer, �e�� __class__r r r "