From 147ba688153b9392311babe5a71dcd7010f30de6 Mon Sep 17 00:00:00 2001 From: Killian Brunswick Date: Sat, 15 Apr 2023 13:38:40 -0400 Subject: [PATCH 1/2] add automail.py --- automail.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 automail.py diff --git a/automail.py b/automail.py new file mode 100644 index 00000000000..f15d61b8c79 --- /dev/null +++ b/automail.py @@ -0,0 +1,24 @@ +#find documentation for ezgmail module at https://pypi.org/project/EZGmail/ +#simple simon says module that interacts with google API to read the subject line of an email and respond to "Simon says:" + +import ezgmail, re, time + +check = True +while check: + recThreads = ezgmail.recent() + findEmail = re.compile(r'<(.*)@(.*)>') + i = 0 + for msg in recThreads: + subEval = recThreads[i].messages[0].subject.split(' ') + sender = recThreads[i].messages[0].sender + if subEval[0] == 'Simon' and subEval[1] == 'says:': + subEval.remove('Simon') + subEval.remove('says:') + replyAddress = findEmail.search(sender).group(0).replace('<','').replace('>','') + replyContent = 'I am now doing ' + ' '.join(subEval) + ezgmail.send(replyAddress, replyContent, replyContent) + ezgmail._trash(recThreads[i]) + if subEval[0] == 'ENDTASK': #remote kill command + check = False + i += 1 + time.sleep(60) #change check frquency; default every minute \ No newline at end of file From 104c79ff6ffff0e147e49bd20647fe9fa09e875f Mon Sep 17 00:00:00 2001 From: Killian Brunswick Date: Sat, 15 Apr 2023 13:51:26 -0400 Subject: [PATCH 2/2] add security warning comment to automail.py --- automail.py | 1 + 1 file changed, 1 insertion(+) diff --git a/automail.py b/automail.py index f15d61b8c79..84b67424408 100644 --- a/automail.py +++ b/automail.py @@ -1,5 +1,6 @@ #find documentation for ezgmail module at https://pypi.org/project/EZGmail/ #simple simon says module that interacts with google API to read the subject line of an email and respond to "Simon says:" +#DO NOT FORGET TO ADD CREDENTIALS.JSON AND TOKEN.JSON TO .GITIGNORE!!! import ezgmail, re, time