
    +Ph                     H    d dl Z d dlZd dlmZ d dlmZ d dlmZ dedefdZ	y)    N)MIMEMultipart)MIMEText)HTTPExceptionto_emailotpc                    t        j                  d      }t        j                  d      }	 d}d| d}t               }||d<   | |d<   ||d<   |j                  t	        |d	             t        j                  d
d      5 }|j                          |j                  ||       |j                  |       d d d        y # 1 sw Y   y xY w# t        $ r}t        dd|       d }~ww xY w)NEMAIL_ADDRESSEMAIL_PASSWORDzOTP KofAcademyzVotre code OTP est : z". Ce code expirera dans 5 minutes.FromToSubjectplainzsmtp.gmail.comiK  i  z"Error when sending otp to email : )status_codedetail)osgetenvr   attachr   smtplibSMTPstarttlsloginsend_message	Exceptionr   )	r   r   email_addressemail_passwordsubjectbodymsgserveres	            Y/Users/theessential/Documents/Github/KofAcademy/kof-academy-backend/app/services/email.pysend_otp_emailr"   	   s    IIo.MYY/0N^"&se+MNo#FD	 I

8D'*+ \\*C0 	%FOOLL7$	% 	% 	%
  ^6XYZX[4\]]^s6   AC >4B;2C ;C C C 	C%C  C%)
r   r   email.mime.multipartr   email.mime.textr   fastapir   strr"        r!   <module>r)      s*    	  . $ !^S ^s ^r(   