-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathemail_template.py
More file actions
120 lines (112 loc) · 4.32 KB
/
email_template.py
File metadata and controls
120 lines (112 loc) · 4.32 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
def render_email_template(first_name="Pythonista", first_paragraph="We’re happy to inform you that your talk titled <span class='highlight'>Brett Cannon on Python, humans... and packaging</span> has been accepted for PyCon Togo 2025. Congratulations, and thank you for your support!", message=""):
"""
Renders the email template with the provided body and subject.
Args:
body (str): The body of the email.
subject (str): The subject of the email.
Returns:
str: The rendered HTML email template.
"""
html = f"""\
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body {{
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
color: #333333;
background-color: #ffffff;
}}
.container {{
max-width: 600px;
margin: auto;
padding: 20px;
}}
.logo {{
text-align: center;
margin-bottom: 20px;
}}
.logo img {{
width: 150px;
}}
/* .content {{
background-color: #f9f9f9;
padding: 20px;
border-radius: 8px;
}} */
.content h2 {{
color: #111111;
}}
.content p {{
line-height: 1.6;
}}
.highlight {{
font-weight: bold;
}}
a {{
color: #007bff;
text-decoration: none;
}}
.footer {{
text-align: center;
font-size: 14px;
margin-top: 30px;
color: #666;
}}
.social-icons {{
margin-top: 10px;
}}
.social-icons img {{
width: 24px;
margin: 0 5px;
vertical-align: middle;
}}
@media (max-width: 600px) {{
.container {{
padding: 15px;
}}
.content {{
padding: 15px;
}}
}}
</style>
</head>
<body>
<div class="container">
<div class="logo">
<img src="https://pycontg.pytogo.org/static/images/pycontogo.png" alt="PyCon TOGO 2025 Logo">
</div>
<div class="content">
{message}
<p><strong>Best regards,</strong></p>
</div>
<div class="footer">
<!-- <img class="logo" src="static/images/pycontogo.png" alt="PyCon TOGO 2025 Logo"> -->
<p><strong>Python Togo Community</strong><br>
<a href="https://wwww.pytogo.org/">Python TOGO</a><br>
Bd de la KARA, +22898273805 / +22892555987 / +22898776682, LOME</p>
<div class="social-icons">
<a href="#"><img src="https://cdn-icons-png.flaticon.com/512/145/145807.png" alt="LinkedIn"></a>
<a href="https://pytogo.org/discord"><img src="https://cdn-icons-png.flaticon.com/512/5968/5968756.png" alt="Discord"></a>
<a href="https://github.com/pytogo-org"><img src="https://cdn-icons-png.flaticon.com/512/25/25231.png" alt="GitHub"></a>
<a href="https://x.com/pytogo_org"><img src="https://cdn-icons-png.flaticon.com/512/733/733635.png" alt="X/Twitter"></a>
<a href="https://www.youtube.com/@PythonTogo"><img src="https://cdn-icons-png.flaticon.com/512/1384/1384060.png" alt="YouTube"></a>
<a href="#"><img src="https://cdn-icons-png.flaticon.com/512/1384/1384063.png" alt="Instagram"></a>
</div>
</div>
</div>
</body>
</html>
"""
return html
if __name__ == "__main__":
# Example usage
email_body = render_email_template(
first_name="John Doe",
first_paragraph="We’re happy to inform you that your talk titled <span class='highlight'>Brett Cannon on Python, humans... and packaging</span> has been accepted for PyCon Togo 2025. Congratulations, and thank you for your support!",
message="<p>As mentioned on our website, due to a limited budget, we’re unable to cover travel, accommodation, or other personal expenses.</p>"
)
print(email_body) #