-
Notifications
You must be signed in to change notification settings - Fork 0
/
send.py
33 lines (30 loc) · 812 Bytes
/
send.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
import sys
# import requests
from datetime import datetime
from formatting import format_msg
from send_mail import send_mail
def send(name, website=None, to_email=None, verbose=False):
assert to_email != None
if website != None:
msg = format_msg(my_name=name)
else:
msg = format_msg(my_name=name)
if verbose:
print(name, website, to_email)
# send the message
try:
send_mail(text=msg, to_emails=[to_email], html=None)
sent = True
except:
sent = False
return sent
if __name__ == "__main__":
print(sys.argv)
name = "Unknown"
if len(sys.argv) > 1:
name = sys.argv[1]
email = None
if len(sys.argv) > 2:
email = sys.argv[2]
response = send(name, to_email=email, verbose=True)
print(response)