-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrocket.py
More file actions
33 lines (28 loc) · 989 Bytes
/
Copy pathrocket.py
File metadata and controls
33 lines (28 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from fastapi_mail import FastMail, MessageSchema, ConnectionConfig
from dotenv import load_dotenv
import os
load_dotenv()
conf = ConnectionConfig(
MAIL_USERNAME=os.getenv("MAIL_USERNAME"),
MAIL_PASSWORD=os.getenv("MAIL_PASSWORD"),
MAIL_FROM=os.getenv("MAIL_FROM"),
MAIL_PORT=int(os.getenv("MAIL_PORT")),
MAIL_SERVER=os.getenv("MAIL_SERVER"),
MAIL_STARTTLS=True,
MAIL_SSL_TLS=False,
USE_CREDENTIALS=True
)
async def send_verification_email(email: str, token: str):
message = MessageSchema(
subject="Rocket Account Activation",
recipients=[email],
body=f"""
Your Activation code is: {token}
Please use this 6-digit code to verify your email address.
Your code will be our reference to all further communication.
If you didn't request this Activation code, please ignore this email.
""",
subtype="html"
)
fm = FastMail(conf)
await fm.send_message(message)