Skip to content

Commit 49560ad

Browse files
authored
Add function to build order confirmation email
1 parent 4b8f3cd commit 49560ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/emailservice/mail_helpers.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from email.message import EmailMessage
2+
3+
def build_order_confirmation_email(name: str, email: str, order_id: str, body: str) -> EmailMessage:
4+
"""
5+
Build a simple order confirmation email.
6+
7+
NOTE: This is a straightforward implementation focused on functionality.
8+
"""
9+
msg = EmailMessage()
10+
msg["From"] = "Hipster Shop <[email protected]>"
11+
msg["To"] = f"{name} <{email}>"
12+
msg["Subject"] = f"Thanks {name}, your order #{order_id} is confirmed"
13+
msg.set_content(body or "Your order has been received and is being processed.")
14+
return msg

0 commit comments

Comments
 (0)