a
    s[ic                   	   @   s  d dl Z d dlZd dlZd dlZze W n eyD   d7ddZY n0 zd dlZejZe  W n* e	e
fy   dZG dd deZY n0 dZdZd	Zd
Zde d e d e d Zde d Zde d e d Zde d e d e d Zde d e d e d e d e d ZdZed e d e d Zed e d Zed e e d Zde d Zde d e d Zed d e d e d e d d e d Zde d e d Zde d  Zde d e d Zed d! d e d e d e d" e d Zde d e d Z ed# e  Z!d$e! d% Z"i Z#i Z$d&d' Z%d8d*d+Z&e'd,krd dl(Z(ed-Z)ed.Z*e*+ , d/krd0Z*nd(Z*ed1Z-e-+ , d/krd0Z-nd(Z-e.  e&e)e*e-d0d2d3Z/e/re0d4 ne/du re0d5 ne0d6 e(1d2 qldS )9    N c                 C   s   t | S )N)input)prompt r   J/var/www/html/django/DPS/env/lib/python3.9/site-packages/validate_email.py	raw_input   s    r   c                   @   s   e Zd ZdS )ServerErrorN)__name__
__module____qualname__r   r   r   r   r   &   s   r   z[ \t]z(?:\r\n)z\x01-\x08\x0b\x0c\x0f-\x1f\x7fz(?:\\.)z(?:(?:*z)?z+)[z\x21-\x27\x2a-\x5b\x5d-\x7e]z(?:|)z\((?:?z)*z?\)z)*(?:z[\w!#$%&\'\*\+\-/=\?\^`\{\|\}~]+z+(?:\.z+)*z\x21\x23-\x5b\x5d-\x7e]z"(?:"z\x21-\x5a\x5e-\x7e]z\[z?\]@^$c              
   C   s^   | t vrVzt| t | < W n: tyT } z"|jdkr>d t | < n W Y d }~n
d }~0 0 t |  S )N   )MX_DNS_CACHEDNSZmxlookupr   Zrcode)hostnameer   r   r   	get_mx_ipc   s    

r   F
   c              
   C   sX  |rt d}|t j nd}ztt| dus8J ||O }|rtsRtd| | 	dd d }t
|}|du r~W dS |D ]p}z|s|d tv rt|d  W   W S tj|d}	|	|d  dt|d < |sz|	  W n tjy   Y n0 W  W dS |	 \}
}|
d	krD|	  |r@|d
|d |
| W q|	d |	| \}
}|
d	krx|	  W  W dS |r|d
|d |
| |	  W q tjy   |r|d|d  Y q tjy   |r|d|d  Y q0 qW dS W nT ty   Y dS  ttjfyR } z |r<|d| W Y d}~dS d}~0 0 dS )a  Indicate whether the given string is a valid email address
    according to the 'addr-spec' portion of RFC 2822 (see section
    3.4.1).  Parts of the spec that are marked obsolete are *not*
    included in this test, and certain arcane constructions that
    depend on circular definitions in the spec may not pass, but in
    general this should correctly identify any email address likely
    to be in use as of 2011.validate_emailNzbFor check the mx records or check if the email exists you must have installed pyDNS python packager      F)timeoutT   z%s answer: %s - %sr   z%s disconected.zUnable to connect to %s.z2ServerError or socket.error exception raised (%s).)logging	getLoggersetLevelDEBUGrematchVALID_ADDRESS_REGEXPr   	Exceptionfindr   MX_CHECK_CACHEsmtplibSMTPconnectquitZSMTPServerDisconnectedZhelodebugmailZrcptZSMTPConnectErrorAssertionErrorr   socketerror)emailZcheck_mxverifyr/   smtp_timeoutloggerr   Zmx_hostsmxsmtpstatus_r   r   r   r   r   p   sn    







r   __main__zEnter email for validation: zValidate MX record? [yN] yTz3Try to contact server for address validation? [yN] r   )r/   r6   zValid!zI'm not sure.zInvalid!)r   )FFFr   )2r%   r+   r!   r2   r   	NameErrorr   r   ZDiscoverNameServersImportErrorAttributeErrorr(   ZWSPCRLFZ	NO_WS_CTLZQUOTED_PAIRFWSZCTEXTZCCONTENTCOMMENTZCFWSZATEXTATOMZDOT_ATOM_TEXTZDOT_ATOMZQTEXTZQCONTENTZQUOTED_STRINGZ
LOCAL_PARTZDTEXTZDCONTENTZDOMAIN_LITERALZDOMAINZ	ADDR_SPECr'   r   r*   r   r   r	   timer4   r8   striplowervalidatebasicConfigresultprintsleepr   r   r   r   <module>   s  






C



