
    Xj                         d dl mZ d dlmZ d dlZd dlmZ d dlmZ  ee	          Z
dededed	efd
Zdededed	efdZdS )    )MIMEMultipart)MIMETextN)settings)
get_loggerto_emailsubjecthtml_contentreturnc           	        K   	 t          d          }||d<   t          j         dt          j         d|d<   | |d<   t	          |d          }|                    |           t          j        |t          j        t          j	        t          j
        t          j        d	           d {V  t                              d
|             dS # t          $ r8}t                              d|  dt!          |                      Y d }~dS d }~ww xY w)NalternativeSubjectz <>FromTohtmlT)hostnameportusernamepassword	start_tlszEmail sent successfully to zFailed to send email to z: F)r   r   SMTP_FROM_NAME	SMTP_FROMr   attach
aiosmtplibsend	SMTP_HOST	SMTP_PORT	SMTP_USERSMTP_PASSWORDloggerinfo	Exceptionerrorstr)r   r   r	   message	html_partes         C/lsinfo/ai/hellotax_ai/base_platform/app/services/platform/email.py
send_emailr)      s8     ..$	%4MM8JMMM \622	y!!!o'#'+
 
 
 	
 	
 	
 	
 	
 	
 	
 	<(<<===t   DDDCFFDDEEEuuuuus   CC 
D
-DD
emailtokennamec                 p   K   t           j         d| }d| d| d| d}t          | d|           d {V S )Nz/verify-email?token=u  
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <style>
            body {
                font-family: Arial, sans-serif;
                line-height: 1.6;
                color: #333;
            }
            .container {
                max-width: 600px;
                margin: 0 auto;
                padding: 20px;
            }
            .header {
                background-color: #4CAF50;
                color: white;
                padding: 20px;
                text-align: center;
                border-radius: 5px 5px 0 0;
            }
            .content {
                background-color: #f9f9f9;
                padding: 30px;
                border-radius: 0 0 5px 5px;
            }
            .button {
                display: inline-block;
                padding: 12px 30px;
                background-color: #4CAF50;
                color: white;
                text-decoration: none;
                border-radius: 5px;
                margin: 20px 0;
            }
            .footer {
                text-align: center;
                margin-top: 20px;
                color: #666;
                font-size: 12px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="header">
                <h1>欢迎加入 HelloTax AI</h1>
            </div>
            <div class="content">
                <p>你好 u   ,</p>
                <p>感谢您注册 HelloTax AI！请点击下面的按钮验证您的邮箱地址：</p>
                <div style="text-align: center;">
                    <a href="u   " class="button">验证邮箱</a>
                </div>
                <p>或者复制以下链接到浏览器：</p>
                <p style="word-break: break-all; color: #666;">uB  </p>
                <p>此链接将在24小时后过期。</p>
                <p>如果您没有注册账户，请忽略此邮件。</p>
            </div>
            <div class="footer">
                <p>&copy; 2026 HelloTax AI. All rights reserved.</p>
            </div>
        </div>
    </body>
    </html>
    u    验证您的邮箱 - HelloTax AI)r   r   r	   )r   FRONTEND_URLr)   )r*   r+   r,   verification_urlr	   s        r(   send_verification_emailr0   #   s      "/LLULL e#  tx  e#  e#  {K  e#  e#  GW  e#  e#  e#L BQ]             )email.mime.multipartr   email.mime.textr   r   
app.configr   common_loggingr   __name__r    r$   boolr)   r0    r1   r(   <module>r9      s    . . . . . . $ $ $ $ $ $           % % % % % %	H		s S      . S        r1   