-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (24 loc) · 1.03 KB
/
main.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
#!usr/bin/python
# -*- coding: utf-8 -*-
from mailer import mailer, InvalidEmailError
import sys, json
if __name__ == '__main__':
json_data_file = open('config.json')
cfg = json.load(json_data_file)
recipient = "[email protected]"
ccList = ["[email protected]"]
sub = "Test Email"
mynotes ="""Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum."""
if len(sys.argv) == 2:
recipient = str(sys.argv[1])
try:
my_mail = mailer(cfg['exchange'])
my_mail.sendmsg(recipient, sub, cc=ccList, mybody=mynotes)
except InvalidEmailError:
print "{0} is an invalid Email address".format(sys.argv[1])