-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.py
79 lines (68 loc) · 1.84 KB
/
feedback.py
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
import os
import sys
from dotenv import load_dotenv
from templateless import (
Content,
Email,
EmailAddress,
Templateless,
Header,
SocialItem,
Service,
Footer,
Theme,
)
def main():
load_dotenv()
api_key = os.getenv("TEMPLATELESS_API_KEY")
if api_key is None:
print("Set TEMPLATELESS_API_KEY to your Templateless API key")
sys.exit(1)
email_address = os.getenv("TEMPLATELESS_EMAIL_ADDRESS")
if email_address is None:
print("Set TEMPLATELESS_EMAIL_ADDRESS to your own email address")
sys.exit(1)
header = (
Header()
.image(src="https://templateless.net/myco.webp", width=100, alt="MyCo")
.build()
)
footer = (
Footer()
.socials(
[
SocialItem(Service.TWITTER, "MyCo"),
SocialItem(Service.GITHUB, "MyCo"),
]
)
.build()
)
content = (
Content()
.theme(Theme.SIMPLE)
.header(header)
.text("Hey Alex,")
.text("I'm Jamie, founder of **MyCo**.")
.text(
"Could you spare a moment to reply to this email with your thoughts on our service? Your feedback is invaluable and directly influences our improvements."
)
.text(
"When you hit reply, your email will go directly to me, and I read each and every one."
)
.text("Thanks for your support,")
.signature("Jamie Parker")
.text("Jamie Parker\n\nFounder @ [MyCo](https://example.com)")
.footer(footer)
.build()
)
email = (
Email()
.to(EmailAddress(email_address))
.subject("Thoughts on service?")
.content(content)
.build()
)
templateless = Templateless(api_key)
templateless.send(email)
if __name__ == "__main__":
main()