xenoslib 0.1.29.12__tar.gz → 0.1.29.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xenoslib-0.1.29.12/xenoslib.egg-info → xenoslib-0.1.29.14}/PKG-INFO +1 -1
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/__main__.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/about.py +1 -1
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/base.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/dev.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/extend.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/linux.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/mail.py +28 -17
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/mock.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/onedrive.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/windows.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14/xenoslib.egg-info}/PKG-INFO +1 -1
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/LICENSE +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/README.md +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/setup.cfg +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/setup.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/__init__.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib/win_trayicon.py +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib.egg-info/SOURCES.txt +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib.egg-info/dependency_links.txt +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib.egg-info/requires.txt +0 -0
- {xenoslib-0.1.29.12 → xenoslib-0.1.29.14}/xenoslib.egg-info/top_level.txt +0 -0
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -75,7 +75,7 @@ class MailFetcher:
|
|
|
75
75
|
payload = body.get_payload(decode=True)
|
|
76
76
|
if body.is_multipart():
|
|
77
77
|
for part in body.walk():
|
|
78
|
-
if "text/
|
|
78
|
+
if "text/html" in part.get_content_type():
|
|
79
79
|
payload = part.get_payload(decode=True)
|
|
80
80
|
if isinstance(payload, bytes):
|
|
81
81
|
try:
|
|
@@ -127,24 +127,19 @@ class SMTPMail:
|
|
|
127
127
|
receivers.append(receiver)
|
|
128
128
|
elif isinstance(receiver, (list, tuple)):
|
|
129
129
|
receivers.extend(receiver)
|
|
130
|
-
msg =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
msg = self.construct_msg(
|
|
131
|
+
subject=subject,
|
|
132
|
+
message=message,
|
|
133
|
+
receivers=receivers,
|
|
134
|
+
cc=cc,
|
|
135
|
+
filename=filename,
|
|
136
|
+
)
|
|
134
137
|
if cc:
|
|
135
138
|
msg["Cc"] = ";".join(cc)
|
|
136
139
|
receivers.extend(cc)
|
|
137
140
|
if bcc:
|
|
138
141
|
receivers.extend(bcc)
|
|
139
|
-
msg["Message-ID"] = make_msgid()
|
|
140
|
-
msg.attach(MIMEText(message, "html", "utf-8"))
|
|
141
|
-
if filename:
|
|
142
|
-
attachment = MIMEApplication(open(filename, "rb").read())
|
|
143
|
-
attachment.add_header("Content-Disposition", "attachment", filename=filename)
|
|
144
|
-
msg.attach(attachment)
|
|
145
|
-
|
|
146
142
|
with self.SMTP(self.smtp_server, self.port) as smtp:
|
|
147
|
-
print(smtp.has_extn("STARTTLS"))
|
|
148
143
|
if smtp.has_extn("STARTTLS"):
|
|
149
144
|
smtp.starttls()
|
|
150
145
|
try:
|
|
@@ -155,6 +150,19 @@ class SMTPMail:
|
|
|
155
150
|
smtp.sendmail(self.sender, receivers, msg.as_string())
|
|
156
151
|
return True
|
|
157
152
|
|
|
153
|
+
def construct_msg(self, subject, message, receivers=None, cc=None, filename=None):
|
|
154
|
+
msg = MIMEMultipart()
|
|
155
|
+
msg["Subject"] = Header(subject, "utf-8")
|
|
156
|
+
msg["From"] = Header(self.sender, "utf-8")
|
|
157
|
+
msg["To"] = ";".join(receivers)
|
|
158
|
+
msg["Message-ID"] = make_msgid()
|
|
159
|
+
msg.attach(MIMEText(message, "html", "utf-8"))
|
|
160
|
+
if filename:
|
|
161
|
+
attachment = MIMEApplication(open(filename, "rb").read())
|
|
162
|
+
attachment.add_header("Content-Disposition", "attachment", filename=filename)
|
|
163
|
+
msg.attach(attachment)
|
|
164
|
+
return msg
|
|
165
|
+
|
|
158
166
|
|
|
159
167
|
def test_imap():
|
|
160
168
|
try:
|
|
@@ -173,7 +181,7 @@ def test_imap():
|
|
|
173
181
|
# ~ print(email_data.keys())
|
|
174
182
|
|
|
175
183
|
|
|
176
|
-
def
|
|
184
|
+
def test_smtp():
|
|
177
185
|
try:
|
|
178
186
|
import env # noqa
|
|
179
187
|
except ModuleNotFoundError:
|
|
@@ -185,9 +193,12 @@ def test():
|
|
|
185
193
|
message = '<span style="color:red">This is a test email.</span>'
|
|
186
194
|
email_sender = SMTPMail(smtp_server, sender=mail_addr, password=mail_pwd, port=465)
|
|
187
195
|
# email_sender = SMTPMail(smtp_server, sender=mail_addr, password=mail_pwd, port=587)
|
|
188
|
-
email_sender.send(subject=subject, message=message, receiver=os.environ["RECEIVER"])
|
|
196
|
+
# ~ email_sender.send(subject=subject, message=message, receiver=os.environ["RECEIVER"],bcc=["haiwe.lu@sap.com"])
|
|
197
|
+
email_sender.send(
|
|
198
|
+
subject=subject, message=message, receiver="luhw@cndatacom.com", bcc=["haiwei.lu@sap.com"]
|
|
199
|
+
)
|
|
189
200
|
|
|
190
201
|
|
|
191
202
|
if __name__ == "__main__":
|
|
192
|
-
test_imap()
|
|
193
|
-
|
|
203
|
+
# ~ test_imap()
|
|
204
|
+
test_smtp()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|