U
    Abb	                     @   s   d d Z edkre  dS )c              
   C   s  dd l }dd l}ddlm}	 ddlm}
 ddlm} ddlm	} |d k	rR|}|}nd}d}|}| }d| |d	< ||d
< ||d< |dd }|dd }|dd  }|d | d | d }d| d | d }|
|
| d|_| } | D ]}z^t|d}|dd}||  W 5 Q R X |	| |jdd|j|d |
| W q   tdt d  Y qX q| }z^|dd@}|  |  |  ||| |||| |  W 5 Q R X td W n   td Y nX d S )N    )encoders)MIMEText)MIMEBase)MIMEMultipartzsupport@farmonaut.comzankur@A8z@Satellite Based Crop Health Monitoring Results - Field Address: SubjectToFrom      -z  (in yyyy-mm-dd)z7Hello,

The new results for your field at the address: z= are available now. The Satellite crossed over your field on a   . There was too much cloud cover over your field for this satellite imagery capture date, hence we could not generate results and processed images for your field for this date. This satellite imagery date will not be counted in your subscription package and your package will be increased by one more satellite visit The next satellite movement is expected in the next 4-10 days. Please find attached below a failed report of the satellite visit.

Regardsz3You will not see this in a MIME-aware mail reader.
rbapplicationzoctet-streamzContent-Disposition
attachment)filenamez.Unable to open one of the attachments. Error: zsmtp.gmail.comiK  zEmail sent!zUnable to send the email)ossmtplibemailr   Zemail.mime.textr   email.mime.baser   email.mime.multipartr   attachpreambleopenset_payloadreadencode_base64
add_headerpathbasenameprintsysexc_info	as_stringSMTPehlostarttlsloginZsendmailclose)attachmentsr   Zfieldaddressdate
whitelabelwhitelabelEmailwhitelabelPasswordr   r   r   r   r   r   senderZgmail_passwordZ	recipientouteryearmonthdaymessagefilefpmsgZcomposeds r6   0/home/ankuromar296_gmail_com/sendfailedreport.pysendfailedreport	   s\    

r8   __main__N)r8   __name__mainr6   r6   r6   r7   <module>	   s   4