o
    1‘]Zþg  ã                   @   sØ  d Z ddlZddlmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlZddlZddlZddlZddlZddlZddlZddlmZ ddlZddlmZmZmZ ddlZdd	lmZ dd
l m!Z!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z: e ;e<¡Z=G dd„ de&j>ƒZ?e-G dd„ de&j@ƒƒZAG dd„ de&j>ƒZBG dd„ de&j>ƒZCG dd„ de&j>ƒZDe-G dd„ de&j@ƒƒZe-G dd „ d e&j@ƒƒZEdS )!z8
Models declaration for application ``django_mailbox``.
é    N)Úencode_base64)ÚMessage)Ú
formatdateÚ	parseaddr)Úencode)ÚNamedTemporaryFile)Úparse_qsÚunquoteÚurlparse)Úsettings)ÚContentFileÚFile)Ú
make_msgid)Úmodels)Úugettext_lazy)Únow)Úpython_2_unicode_compatible)Úutils)Úmessage_received)ÚPop3TransportÚImapTransportÚMaildirTransportÚMboxTransportÚBabylTransportÚMHTransportÚMMDFTransportÚGmailImapTransportc                       ó   e Zd Z‡ fdd„Z‡  ZS )ÚActiveMailboxManagerc                    ó   t t| ƒ ¡ jdd�S )NT)Úactive)Úsuperr   Úget_querysetÚfilter©Úself©Ú	__class__© úG/var/www/html/env/lib/python3.10/site-packages/django_mailbox/models.pyr"   +   ó   ÿz!ActiveMailboxManager.get_queryset©Ú__name__Ú
__module__Ú__qualname__r"   Ú__classcell__r(   r(   r&   r)   r   *   ó    r   c                   @   s|  e Zd Zejedƒdd�Zejedƒdedƒdddd�Zejed	ƒded
ƒdddd�Zej	edƒedƒddd�Z
ejedƒedƒddd�Ze ¡ Zeƒ Zedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd „ ƒZed!d"„ ƒZed#d$„ ƒZed%d&„ ƒZed'd(„ ƒZd)d*„ Zd+d,„ Zd-d.„ Z d/d0„ Z!d1d2„ Z"d3d4„ Z#d;d5d6„Z$d7d8„ Z%G d9d:„ d:ƒZ&dS )<ÚMailboxÚNameéÿ   ©Ú
max_lengthÚURIaI  Example: imap+ssl://myusername:mypassword@someserver <br /><br />Internet transports include 'imap' and 'pop3'; common local file transports include 'maildir', 'mbox', and less commonly 'babyl', 'mh', and 'mmdf'. <br /><br />Be sure to urlencode your username and password should they contain illegal characters (like @, :, etc).TN)r5   Ú	help_textÚblankÚnullÚdefaultz
From emaila4  Example: MailBot &lt;mailbot@yourdomain.com&gt;<br />'From' header to set for outgoing email.<br /><br />If you do not use this e-mail inbox for outgoing mail, this setting is unnecessary.<br />If you send e-mail without setting this, your 'From' header will'be set to match the setting `DEFAULT_FROM_EMAIL`.ÚActivea  Check this e-mail inbox for new e-mail messages during polling cycles.  This checkbox does not have an effect upon whether mail is collected here when this mailbox receives mail from a pipe, and does not affect whether e-mail messages can be dispatched from this mailbox. )r7   r8   r:   zLast pollingz’The time of last successful polling for messages.It is blank for new mailboxes and is not set for mailboxes that only receive messages via a pipe.)r7   r8   r9   c                 C   s
   t | jƒS ©N)r
   Úurir$   r(   r(   r)   Ú_protocol_infot   s   
zMailbox._protocol_infoc                 C   ó   t | jjƒS r<   )r   r>   Úqueryr$   r(   r(   r)   Ú_query_stringx   s   zMailbox._query_stringc                 C   ó   | j jS r<   )r>   Úhostnamer$   r(   r(   r)   Ú_domain|   s   zMailbox._domainc                 C   rB   )z.Returns the port to use for fetching messages.)r>   Úportr$   r(   r(   r)   rE   €   s   zMailbox.portc                 C   r?   )z2Returns the username to use for fetching messages.)r	   r>   Úusernamer$   r(   r(   r)   rF   …   ó   zMailbox.usernamec                 C   r?   )z2Returns the password to use for fetching messages.)r	   r>   Úpasswordr$   r(   r(   r)   rH   Š   rG   zMailbox.passwordc                 C   s   | j r| j S d| jj S )z3Returns the location (domain and path) of messages.Ú )rD   r>   Úpathr$   r(   r(   r)   Úlocation�   s   zMailbox.locationc                 C   s&   | j j ¡ }d|v r| d¡d S |S )z.Returns the 'transport' name for this mailbox.ú+r   )r>   ÚschemeÚlowerÚsplit)r%   rM   r(   r(   r)   Útype”   s   zMailbox.typec                 C   ó   d| j j ¡ v S )z:Returns whether or not this mailbox's connection uses SSL.z+ssl©r>   rM   rN   r$   r(   r(   r)   Úuse_sslœ   ó   zMailbox.use_sslc                 C   rQ   )z?Returns whether or not this mailbox's connection uses STARTTLS.z+tlsrR   r$   r(   r(   r)   Úuse_tls¡   rT   zMailbox.use_tlsc                 C   ó   | j  dd¡}|sdS |d S )z9Returns (if specified) the folder to archive messages to.ÚarchiveNr   ©rA   Úget)r%   Úarchive_folderr(   r(   r)   rW   ¦   ó   zMailbox.archivec                 C   rV   )z5Returns (if specified) the folder to fetch mail from.ÚfolderNr   rX   )r%   r\   r(   r(   r)   r\   ®   r[   zMailbox.folderc                 C   sD  | j sdS | jdkr)t| j| jr| jnd| j| j| j| jd�}| 	| j
| j¡ |S | jdkrHt| j| jr7| jndd| jd�}| 	| j
| j¡ |S | jdkrft| j| jrV| jnd| jd�}| 	| j
| j¡ |S | jd	krrt| jƒ}|S | jd
kr~t| jƒ}|S | jdkrŠt| jƒ}|S | jdkr–t| jƒ}|S | jdkr t| jƒ}|S )zžReturns the transport instance for this mailbox.

        These will always be instances of
        `django_mailbox.transports.base.EmailTransport`.

        NÚimap)rE   ÚsslÚtlsrW   r\   ÚgmailT)rE   r^   rW   Úpop3)rE   r^   ÚmaildirÚmboxÚbabylÚmhÚmmdf)r=   rP   r   rK   rE   rS   rU   rW   r\   ÚconnectrF   rH   r   r   r   r   r   r   r   )r%   Úconnr(   r(   r)   Úget_connection¶   sZ   
ú
çü
ïý
ö
	
ø

ú

ü

þ
zMailbox.get_connectionc                 C   s6   |   |¡}|du rdS d|_| ¡  tj| |d� |S )z+Process a message incoming to this mailbox.NF)ÚsenderÚmessage)Ú_process_messageÚoutgoingÚsaver   Úsend©r%   rk   Úmsgr(   r(   r)   Úprocess_incoming_messageä   s   
z Mailbox.process_incoming_messagec                 C   s(   |   |¡}|du rdS d|_| ¡  |S )z8Record an outgoing message associated with this mailbox.NT)rl   rm   rn   rp   r(   r(   r)   Úrecord_outgoing_messageð   s   
zMailbox.record_outgoing_messagec              	   C   s0  t  ¡ }tƒ }| ¡ r*| ¡ D ]\}}|||< q| ¡ D ]}| |  ||¡¡ q|S |d rW| ¡ |d vrW| ¡ D ]\}}|||< q:|d= d| ¡  ||d < | 	d¡ |S | ¡ |d vsgd| 
d	d¡v rÈd }| ¡ }	|	rtt  |	¡}|s~t | ¡ ¡}
ntj |¡\}}
|
sŠd
}
tƒ }|j t ¡ j|
 tt |jdd�¡ ¡ ƒ¡ ||_| ¡ D ]\}}|||< q«| ¡  tƒ }t|jƒ||d < |}|S | ¡ }|sÐd}z|jdd�  |¡ W n8 t!y÷   t" #d|¡ | 	|jdd�  dd¡¡ Y n t$�y   t" #d|¡ | 	|jdd�  dd¡¡ Y nw |}|S )NÚstrip_unallowed_mimetypesÚallowed_mimetypesúContent-Transfer-Encodingz%Stripped; Content type %s not allowedÚaltered_message_headerrI   Útext_stored_mimetypesÚ
attachmentzContent-Dispositionz.binT)ÚdecodeÚattachment_interpolation_headerÚasciiz+Unknown encoding %s; interpreting as ASCII!Úignorez5Decoding error encountered; interpreting %s as ASCII!)%r   Úget_settingsÚEmailMessageÚis_multipartÚitemsÚget_payloadÚattachÚ_get_dehydrated_messageÚget_content_typeÚset_payloadrY   Úget_filenameÚconvert_header_to_unicodeÚ	mimetypesÚguess_extensionÚosrJ   ÚsplitextÚMessageAttachmentÚdocumentrn   ÚuuidÚuuid4Úhexr   ÚsixÚBytesIOÚgetvaluerk   ÚstrÚpkÚget_content_charsetrz   ÚLookupErrorÚloggerÚwarningÚ
ValueError)r%   rq   Úrecordr   ÚnewÚheaderÚvalueÚpartÚfilenameÚraw_filenameÚ	extensionÚ_ry   ÚkeyÚplaceholderÚcontent_charsetr(   r(   r)   r„   ù   s¨   

ÿW­ÿ
ÿ
ÿ
F½

ÿýþ
þÿ!áþþÿþþÿûzMailbox._get_dehydrated_messagec              
   C   sV  t ƒ }t ¡ }|d r|  ||¡ | |_d|v r$t |d ¡dd… |_d|v r3|d dd…  ¡ |_d|v r?t |d ¡|_	d|v rLt |d ¡|_
nd|v rXt |d ¡|_
| ¡  |  ||¡}z| ¡ }W n ty� } zt d	|¡ W Y d }~d S d }~ww | |¡ |d
 r¥zt jj|d
  ¡ d�d |_W n	 ty¤   Y nw | ¡  |S )NÚstore_original_messageÚsubjectr   r3   z
message-idÚfromÚtozDelivered-TozFailed to parse message: %szin-reply-to)Ú
message_id)r   r   r~   Ú_process_save_original_messageÚmailboxrˆ   r©   Ústripr¬   Úfrom_headerÚ	to_headerrn   r„   Ú	as_stringÚKeyErrorr™   rš   Úset_bodyÚobjectsr#   Úin_reply_toÚ
IndexError)r%   rk   rq   r   ÚbodyÚexcr(   r(   r)   rl   Z  sP   ÿÿ€ü

ÿ
þÿzMailbox._process_messagec              	   C   sÈ   t  ¡ }|d rQtdd��:}tj|dd��}| | ¡  d¡¡ W d   ƒ n1 s*w   Y  |jj	dt
 ¡ f t|ƒdd	� W d   ƒ d S 1 sJw   Y  d S |jj	d
t
 ¡  t| ¡ ƒdd	� d S )NÚcompress_original_messagez.eml.gz)ÚsuffixÚw)ÚfileobjÚmodeúutf-8z	%s.eml.gzF)rn   z%s.eml)r   r~   r   ÚgzipÚGzipFileÚwriter²   r   Úemlrn   r�   r�   r   r   )r%   rk   rq   r   Úfp_tmpÚfpr(   r(   r)   r­   ƒ  s"   ÿý"ý



ýz&Mailbox._process_save_original_messagec                 C   sp   g }|   ¡ }|s
|S | |¡D ]}|  |¡}|dur| |¡ qtƒ | _tjdkr2| jdgd� |S |  ¡  |S )z1Connect to this transport and fetch new messages.N)é   é   Úlast_polling)Úupdate_fields)	ri   Úget_messagerr   Úappendr   rÈ   ÚdjangoÚVERSIONrn   )r%   Ú	conditionÚnew_mailÚ
connectionrk   rq   r(   r(   r)   Úget_new_mail–  s   

€
ÿzMailbox.get_new_mailc                 C   ó   | j S r<   )Únamer$   r(   r(   r)   Ú__str__§  ó   zMailbox.__str__c                   @   ó   e Zd ZedƒZedƒZdS )zMailbox.Metar1   Ú	MailboxesN©r,   r-   r.   r¤   Úverbose_nameÚverbose_name_pluralr(   r(   r(   r)   ÚMetaª  ó    rÛ   r<   )'r,   r-   r.   r   Ú	CharFieldr¤   rÓ   r=   Ú
from_emailÚBooleanFieldr    ÚDateTimeFieldrÈ   ÚManagerrµ   r   Úactive_mailboxesÚpropertyr>   rA   rD   rE   rF   rH   rK   rP   rS   rU   rW   r\   ri   rr   rs   r„   rl   r­   rÑ   rÔ   rÛ   r(   r(   r(   r)   r1   1   s”    þÿ
ñÿ	òÿöú	











.	a)
r1   c                       r   )ÚIncomingMessageManagerc                    r   )NF©rm   )r!   rä   r"   r#   r$   r&   r(   r)   r"   °  r*   z#IncomingMessageManager.get_querysetr+   r(   r(   r&   r)   rä   ¯  r0   rä   c                       r   )ÚOutgoingMessageManagerc                    r   )NTrå   )r!   ræ   r"   r#   r$   r&   r(   r)   r"   ·  r*   z#OutgoingMessageManager.get_querysetr+   r(   r(   r&   r)   ræ   ¶  r0   ræ   c                       r   )ÚUnreadMessageManagerc                    s   t t| ƒ ¡ jd d�S )N)Úread)r!   rç   r"   r#   r$   r&   r(   r)   r"   ¾  r*   z!UnreadMessageManager.get_querysetr+   r(   r(   r&   r)   rç   ½  r0   rç   c                       s¤  e Zd Zejededƒejd�Zej	edƒdd�Z
ej	edƒdd�Zejdd	d
d
edƒejd�Zej	edƒdd�Ze edƒ¡Zejedƒdd
d�Ze edƒ¡Zejedƒdedƒd�Zejedƒd
d�Zejedƒdd
d
d�Zejedƒd
dedƒd�Ze ¡ Zeƒ Zeƒ Zeƒ Z e!dd„ ƒZ"e!d d!„ ƒZ#e!d"d#„ ƒZ$d$d%„ Z%e!d&d'„ ƒZ&e!d(d)„ ƒZ'd*d+„ Z(d,d-„ Z)d.d/„ Z*d0d1„ Z+‡ fd2d3„Z,d4d5„ Z-G d6d7„ d7ƒZ.‡  Z/S )8r   Úmessagesr1   )Úrelated_namerÙ   Ú	on_deleteÚSubjectr3   r4   z
Message IDzdjango_mailbox.MessageÚrepliesTzIn reply to)rê   r8   r9   rÙ   rë   zFrom headerz	To headerÚOutgoingF)r:   r8   ÚBodyÚEncodedz)True if the e-mail body is Base64 encoded)r:   r7   Ú	Processed)Úauto_now_addÚReadN)r:   r8   r9   zRaw message contentsz Original full content of message)r9   Ú	upload_tor7   c                 C   s   g }| j | j }|S )aŽ  Property allowing one to get the relevant address(es).

        In earlier versions of this library, the model had an `address` field
        storing the e-mail address from which a message was received.  During
        later refactorings, it became clear that perhaps storing sent messages
        would also be useful, so the address field was replaced with two
        separate fields.

        )Úto_addressesÚfrom_address)r%   Ú	addressesr(   r(   r)   Úaddress  s   zMessage.addressc                 C   s   | j rt| j ƒd  ¡ gS g S )aV  Returns the address (as a list) from which this message was received

        .. note::

           This was once (and probably should be) a string rather than a list,
           but in a pull request received long, long ago it was changed;
           presumably to make the interface identical to that of
           `to_addresses`.

        rÆ   )r°   r   rN   r$   r(   r(   r)   rö     s   zMessage.from_addressc                 C   s4   g }| j  d¡D ]}|r| t|ƒd  ¡ ¡ q|S )z;Returns a list of addresses to which this message was sent.ú,rÆ   )r±   rO   rË   r   rN   )r%   r÷   rø   r(   r(   r)   rõ   0  s   ÿþý€zMessage.to_addressesc                 C   sl   |j s| jj r| jj |_ ntj|_ tƒ |jd< tƒ |jd< | j ¡ |jd< | 	¡  | j 
t | ¡  ¡ ¡¡S )a*  Sends a message as a reply to this message instance.

        Although Django's e-mail processing will set both Message-ID
        and Date upon generating the e-mail message, we will not be able
        to retrieve that information through normal channels, so we must
        pre-set it.

        z
Message-IDÚDatezIn-Reply-To)rÞ   r®   Údjango_settingsÚDEFAULT_FROM_EMAILr   Úextra_headersr   r¬   r¯   ro   rs   ÚemailÚmessage_from_stringrk   r²   )r%   rk   r(   r(   r)   Úreply=  s   	
ÿÿzMessage.replyc                 C   ó   t  |  ¡ dd¡ dd¡ ¡ S )zN
        Returns the message body matching content type 'text/plain'.
        ÚtextÚplainz=
rI   ©r   Úget_body_from_messageÚget_email_objectÚreplacer¯   r$   r(   r(   r)   r  U  ó
   
ÿþzMessage.textc                 C   r  )zM
        Returns the message body matching content type 'text/html'.
        r  ÚhtmlÚ
rI   r  r$   r(   r(   r)   r	  ^  r  zMessage.htmlc           
      C   sˆ  t ƒ }t ¡ }| ¡ r)| ¡ D ]\}}|||< q| ¡ D ]
}| |  |¡¡ q|S |d | ¡ v r®z`t	j
j||d  d�}| ¡ D ]\}}|||< qA|d }|r}| ¡ dkr}t ¡ }	tt |j ¡ ¡|	ddd� | |	 ¡  ¡  dd	¡¡ |d= d|d< n| |j ¡ ¡ |d= t|ƒ W |S W |S  t	jy­   d
||d   ||d < | d¡ Y |S w | ¡ D ]\}}|||< q²| | ¡ ¡ |S )Nr{   )r–   rv   zquoted-printableTF)Ú	quotetabsrž   ú z=20z Missing; Attachment %s not foundrw   rI   )r   r   r~   r€   r�   r‚   rƒ   Ú
_rehydrateÚkeysr�   rµ   rY   rN   r’   r“   Úencode_quoprirŽ   rè   r†   r”   rz   r  r   ÚDoesNotExist)
r%   rq   r�   r   rž   rŸ   r    ry   ÚencodingÚoutputr(   r(   r)   r  g  sn   
ÿ/Ô
ÿ
ÿúÿ
ÿ
ìó
ÿ
ÿó
ÿzMessage._rehydratec                 C   s$   | j rt | j d¡¡S | j d¡S )z›Returns the `body` field of this record.

        This will automatically base64-decode the message contents
        if they are encoded as such.

        r|   r¿   )ÚencodedÚbase64Ú	b64decoder¸   r   r$   r(   r(   r)   Úget_body   s   zMessage.get_bodyc                 C   s,   t jr| d¡}d| _t |¡ d¡| _dS )zóSet the `body` field of this record.

        This will automatically base64-encode the message contents to
        circumvent a limitation in earlier versions of Django in which
        no fields existed for storing arbitrary bytes.

        r¿   Tr|   N)r’   ÚPY3r   r  r  Ú	b64encoderz   r¸   )r%   r¸   r(   r(   r)   r´   «  s   
zMessage.set_bodyc                 C   sx   | j r%| j j d¡rtj| j d� ¡ }n| j  ¡  | j j ¡ }| j  ¡  n|  	¡ }t
jr2t |¡}nt |¡}|  |¡S )aã  Returns an `email.message.Message` instance representing the
        contents of this message and all attachments.

        See [email.Message.Message]_ for more information as to what methods
        and properties are available on `email.message.Message` instances.

        .. note::

           Depending upon the storage methods in use (specifically --
           whether ``DJANGO_MAILBOX_STORE_ORIGINAL_MESSAGE`` is set
           to ``True``, this may either create a "rehydrated" message
           using stored attachments, or read the message contents stored
           on-disk.

        .. [email.Message.Message]: Python's `email.message.Message` docs
           (https://docs.python.org/2/library/email.message.html)

        z.gz)r½   )rÃ   rÓ   ÚendswithrÀ   rÁ   rè   ÚopenÚfileÚcloser  r’   r  rþ   Úmessage_from_bytesrÿ   r  )r%   r¸   Úflatr(   r(   r)   r  ¸  s   


zMessage.get_email_objectc                    s.   | j  ¡ D ]}| ¡  qtt| ƒj|i |¤ŽS )z/Delete this message and all stored attachments.)ÚattachmentsÚallÚdeleter!   r   )r%   ÚargsÚkwargsry   r&   r(   r)   r!  Ú  s   
zMessage.deletec                 C   rÒ   r<   )r©   r$   r(   r(   r)   rÔ   á  rÕ   zMessage.__str__c                   @   rÖ   )zMessage.MetazE-mail messagezE-mail messagesNrØ   r(   r(   r(   r)   rÛ   ä  rÜ   rÛ   )0r,   r-   r.   r   Ú
ForeignKeyr1   r¤   ÚCASCADEr®   rÝ   r©   r¬   r¶   r°   Ú	TextFieldr±   rß   rm   r¸   r  rà   Ú	processedrè   Ú	FileFieldrÃ   rá   rµ   rç   Úunread_messagesrä   Úincoming_messagesræ   Úoutgoing_messagesrã   rø   rö   rõ   r   r  r	  r  r  r´   r  r!  rÔ   rÛ   r/   r(   r(   r&   r)   r   Ä  s¢    üþþú	þÿýÿýþüü




9"r   c                       s®   e Zd Zejedddedƒejd�Zej	edƒddd�Z
ejedƒejd�Z‡ fd	d
„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZG dd„ dƒZ‡  ZS )r�   r  Tr   )rê   r9   r8   rÙ   rë   ÚHeaders)r9   r8   ÚDocument)rô   c                    s    | j  ¡  tt| ƒj|i |¤ŽS )zDeletes the attachment.)rŽ   r!  r!   r�   )r%   r"  r#  r&   r(   r)   r!  ÿ  s   
zMessageAttachment.deletec                 C   sZ   | j }|d u r
tƒ S tjdk r(z| d¡}W n ty'   | d¡ d¡}Y nw t |¡S )N)é   r   r¿   )	Úheadersr   ÚsysÚversion_infor   ÚUnicodeDecodeErrorrz   rþ   rÿ   )r%   r/  r(   r(   r)   Ú_get_rehydrated_headers  s   
ÿ
z)MessageAttachment._get_rehydrated_headersc                 C   s   |  ¡ | _d S r<   )r²   r/  )r%   Úemail_objectr(   r(   r)   Ú_set_dehydrated_headers  s   z)MessageAttachment._set_dehydrated_headersc                 C   s   |   ¡ }||= |  |¡ d S r<   ©r3  r5  )r%   rÓ   Ú
rehydratedr(   r(   r)   Ú__delitem__  s   zMessageAttachment.__delitem__c                 C   s   |   ¡ }|||< |  |¡ d S r<   r6  )r%   rÓ   rŸ   r7  r(   r(   r)   Ú__setitem__  s   zMessageAttachment.__setitem__c                 C   s6   |   ¡  ¡ }t|tjƒrt |¡}|du r|S |S dS )z1Returns the original filename of this attachment.N)r3  r‡   Ú
isinstancer’   Ústring_typesr   rˆ   )r%   Ú	file_nameÚresultr(   r(   r)   r‡     s   
zMessageAttachment.get_filenamec                 C   s   |   ¡  ¡ S r<   )r3  r�   r$   r(   r(   r)   r�   '  s   zMessageAttachment.itemsc                 C   s$   |   ¡ | }|d u rtd| ƒ‚|S )NzHeader %s does not exist)r3  r³   )r%   rÓ   rŸ   r(   r(   r)   Ú__getitem__*  s   zMessageAttachment.__getitem__c                 C   rB   r<   )rŽ   Úurlr$   r(   r(   r)   rÔ   0  s   zMessageAttachment.__str__c                   @   rÖ   )zMessageAttachment.MetazMessage attachmentzMessage attachmentsNrØ   r(   r(   r(   r)   rÛ   3  rÜ   rÛ   )r,   r-   r.   r   r$  r   r¤   r%  rk   r&  r/  r(  r   Úget_attachment_save_pathrŽ   r!  r3  r5  r8  r9  r‡   r�   r>  rÔ   rÛ   r/   r(   r(   r&   r)   r�   é  s8    ú	ýþr�   )FÚ__doc__rÀ   Úemail.encodersr   Úemail.messager   r   Úemail.utilsr   r   Úquoprir   r  r  rþ   Úloggingr‰   Úos.pathr‹   r0  r�   Útempfiler   r’   Úsix.moves.urllib.parser   r	   r
   rÌ   Údjango.confr   rû   Údjango.core.files.baser   r   Údjango.core.mail.messager   Ú	django.dbr   Údjango.utils.translationr   r¤   Údjango.utils.timezoner   Údjango.utils.encodingr   Údjango_mailboxr   Údjango_mailbox.signalsr   Údjango_mailbox.transportsr   r   r   r   r   r   r   r   Ú	getLoggerr,   r™   rá   r   ÚModelr1   rä   ræ   rç   r�   r(   r(   r(   r)   Ú<module>   sT   (
    &