-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsendingmail.py
More file actions
46 lines (39 loc) · 1.15 KB
/
Copy pathsendingmail.py
File metadata and controls
46 lines (39 loc) · 1.15 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
# SMTP - Simple Mail Transfer Protocol
# smtplib - Python's email library
import smtplib
my_email = "ashdev755@gmail.com"
password = "3WNcmC42voSU"
connection = smtplib.SMTP("smtp.gmail.com")
connection.starttls()
connection.login(user=my_email,password=password)
connection.sendmail(
from_addr=my_email,
to_addrs="ashdev97@yahoo.com",
msg="Subject:Subject Line\n\nThis is the body of the email"
)
connection.close()
# OR
with smtplib.SMTP("smtp.gmail.com") as connection:
connection.starttls()
connection.login(user=my_email,password=password)
connection.sendmail(
from_addr=my_email,
to_addrs="ashdev97@yahoo.com",
msg="Subject:Subject Line\n\nThis is the body of the email"
)
# this will open and clse the connection without you having to do it manually using .close()
# DateTime Module
import datetime as dt
now = dt.datetime.now()
print(now)
print(now.year)
year = now.year
day = now.today
# time = now.
if year == 2021:
print("Still wearing face masks")
month = now.month
day_of_week = now.weekday()
print(day_of_week)
date_of_birth = dt.datetime(year=1993,month=7, day=27)
print(date_of_birth.weekday())