-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail_en.py
153 lines (137 loc) · 3.89 KB
/
mail_en.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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env python3
# ENGLISH VERSION
# SCRIPT - MAINTENANCE
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# auto-configuration
# PLEASE DO NOT ADJUST THESE FIVE VARIABLES
sender_email = sys.argv[1] # SMTP E-mail sender
recipient_emails = sys.argv[2].split(',') # List of all recipients of the email
smtp_server = sys.argv[3] # SMTP Server
smtp_port = sys.argv[4] # SMTP Server Port
smtp_username = sys.argv[5] # SMTP E-mail sender
smtp_password = sys.argv[6] # SMTP App-Passwort
# ADJUSTMENTS CAN BE MADE FROM HERE
subject = 'Lorem ipsum' # Email subject
# HTML message
html_content = """
<!DOCTYPE html>
<html>
<head>
<style>
table.top {
padding: 25px;
border: 1px solid black;
background-color: #F4F6F7;
margin: 0;
border-radius: 10px;
text-align: left;
align-items: center;
justify-content: center;
width: 85%;
margin-left: auto;
margin-right: auto;
}
#status_link:link {
color: #1F618D;
}
#status_link:visited {
color: #1F618D;
}
#status_link:hover {
color: red;
}
#status_link:active {
color: green;
}
#mail_link:link {
text-decoration: none;
color: grey;
}
#mail_link:visited {
text-decoration: none;
color: grey;
}
#mail_link:hover {
text-decoration: underline;
color: blue;
}
#mail_link:active {
text-decoration: underline;
color: blue;
}
</style>
</head>
<body>
<table class="top">
<tr>
<td colspan="2" style="text-align: center; font-size: 25px; font-weight: 900; color: #229954">Easy Tec Services</td>
</tr>
<tr>
<td colspan="2" style="text-align: center; font-size: 20px; font-weight: 800; color: #F5B041">INCIDENT</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td class="p1" colspan="2">Dear Sir or Madam,</td>
</tr>
<tr>
<td class="p1" colspan="2">we would like to inform you that there is currently a failure in our Easy Tec services. Our technicians are already working at full speed to identify and fix the problem in order to restore smooth operation as soon as possible.</td>
</tr>
<tr>
<td class="p1" colspan="2">We are sorry for any possible trouble this may cause you and thank you for your understanding.</td>
</tr>
<tr>
<td class="p2" colspan="2"> </td>
</tr>
<tr>
<td class="p1" colspan="2">We would like to point out that you can view the current status of all faults on our status page at any time.</td>
</tr>
<tr>
<td class="p1" colspan="2"><a id="status_link" href="https://easytecstatus.statuspage.io/" target="_blank">View current status</a></td>
</tr>
<tr>
<td class="p2" colspan="2"> </td>
</tr>
<tr>
<td class="p1" colspan="2">Thank you for your patience and cooperation.</td>
</tr>
<tr>
<td class="p2" colspan="2"> </td>
</tr>
<tr>
<td class="p1" colspan="2">Yours sincerely,<br>Your Easy Tec Services Team</td>
</tr>
<tr>
<td class="p2" colspan="2"> </td>
</tr>
<tr>
<td colspan="2" style="color: grey">
<p class="p1">This email was sent automatically.<br>Please do not reply to this email.<br>For questions, use this email: <a id="mail_link" href="mailto:[email protected]" target="_blank">[email protected]</a></p>
</td>
</tr>
</table>
<div style="padding: 5px; text-align:center; color: grey; font-size: 10px">© 2023 Easy Tec</div>
</body>
</html>
"""
# Connect to the SMTP server
server = smtplib.SMTP(smtp_server, smtp_port)
server.starttls()
server.login(smtp_username, smtp_password)
for recipient_email in recipient_emails:
# Create the MIME message
msg = MIMEMultipart('alternative')
msg['From'] = sender_email
msg['To'] = recipient_email
msg['Subject'] = subject
# Adding the HTML content to the message
html_part = MIMEText(html_content, 'html')
msg.attach(html_part)
# Sending the e-mail
server.sendmail(sender_email, recipient_email, msg.as_string())
# Close connection to SMTP server
server.quit()