from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import smtplib # Function to send activation email with HTML content def send_activation_email(email: str, activation_otp: int): sender_email = "chandratresoham@gmail.com" # Update with your email address sender_password = "wbuc okcv hzzn iwyx" # Update with your email password # Update with your website URL # HTML content for the email body email_body = f"""

Hello,

You have successfully registered to the system.

Please enter below otp to verify your accout

{activation_otp}



Thank you!

""" # Create MIMEText object with HTML content message = MIMEMultipart("alternative") message['From'] = sender_email message['To'] = email message['Subject'] = "Activate your account" message.attach(MIMEText(email_body, 'html')) # Connect to SMTP server and send email with smtplib.SMTP('smtp.gmail.com', 587) as server: # Update with your SMTP server details server.starttls() server.login(sender_email, sender_password) server.sendmail(sender_email, email, message.as_string())