pothole_detect / utils /email_validator.py
Soham Chandratre
Add application file
f1495be
raw
history blame
1.39 kB
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"""
<html>
<body>
<p>
Hello,<br><br>
You have successfully registered to the system.<br><br>
Please enter below otp to verify your accout<br><br>
<p style="font-size:17px; font-weight:bold">{activation_otp}</p><br><br>
Thank you!<br>
</p>
</body>
</html>
"""
# 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())