-
Notifications
You must be signed in to change notification settings - Fork 0
/
Absentee_email.py
40 lines (35 loc) · 1.07 KB
/
Absentee_email.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
# from mailthon.envelope import Envelope
# from mailthon.enclosure import PlainText
# from mailthon import postman as postman_
# envelope = Envelope(
# headers={
# 'Sender': 'sender <[email protected]>',
# 'To': '[email protected]',
# 'Subject': 'Hello World!',
# },
# enclosure=[
# PlainText('Hi!'),
# ]
# )
# postman = postman_(
# host='mail.google.com',
# port=80,
# force_tls=True,
# auth=('[email protected]', 'awaisn@25'),
# )
# # response = postman.send(envelope)
# # print(postman, envelope)
# # print(response.message)
# # print(response.status_code)
# # if response.ok:
# # print("OK! :)")
from mailthon import postman, email
p = postman(host='smtp.gmail.com', auth=('[email protected]', 'fbcabwnopmdugkhx'))
r = p.send(email(
content=u'<p>This user is absent</p>',
subject='Hello world',
sender='Awais <[email protected]>',
receivers=['[email protected]'],
))
assert r.ok
# print(r)