
    =h;                     h   d dl mZ d dlmZ d dlZd dlZd dlmZ d dlm	Z	 d dl
Z
d dlZ e	         e       Z ej                  d      Z e ej                  d            Z ej                  d      Z ej                  d	      Z ej                  d
      ZdededefdZdededefdZdedefdZy)    )FastAPI)EmailStrN)EmailMessage)load_dotenvSMTP_SERVER	SMTP_PORTSMTP_USERNAMESMTP_PASSWORDEMAIL_SENDERto_emailsubjectbodyc                    t               }||d<   t        |d<   | |d<   |j                  |       |j                  |d       t	        j
                  t        j                               }t        j                  t        t        |      5 }|j                  t        t               |j                  |       d d d        y # 1 sw Y   y xY w)NSubjectFromTohtml)subtype)cafile)context)r   r   set_contentadd_alternativesslcreate_default_contextcertifiwheresmtplibSMTP_SSLr   r   loginr	   r
   send_message)r   r   r   msgr   servers         D/var/www/html/phonemate/phone_mate_backend/services/email_service.py
send_emailr$      s    
.CC	NCKCIOODf-((@G			+y'	Bf]M2C  
C	B	Bs   
,B??Cnameotpc                 4    d}d| d| d}t        | ||       y)NzSignup OTP PhoneMatezP
    <html> 
    <body>
        <h2>Welcome to Phone Mate</h2>
        <p>Hello z},</p>
        <p>Your account has been created. Please enter the below otp to continue:</p>
        <p><strong>Otp:</strong> !<br>
    </body>
    </html>
    Tr$   )r   r%   r&   r   	html_bodys        r#   send_signup_otp_emailr+   "   s<    
 %G  ""% '	I x),    c                 .    d}d| d}t        | ||       y)NzRecover Password PhoneMatez
    <html> 
    <body>
        <h2>Recover your password on PhoneMate</h2>
        <p>Hi,</p>
        <p>Please use the below otp to recover your password on phonemate:</p>
        <p><strong>Otp:</strong> r(   Tr)   )r   r&   r   r*   s       r#   send_forgot_password_otp_emailr.   5   s2    
 +G" #& '	I x),r,   )fastapir   pydanticr   r   r   email.messager   dotenvr   r   osappgetenvr   intr   r	   r
   r   strr$   r+   r.    r,   r#   <module>r9      s       &   	 i bii&			+&'			/*		/*ryy(! !C !s ! & r,   