[SUCS Devel] [Git][sucs/accountmanager][master] Renewal sender func does some logging and tells people its been run

Imran Hussain imranh at sucs.org
Sun Mar 10 14:27:25 GMT 2019


Imran Hussain pushed to branch master at sucs / accountmanager


Commits:
99dc9590 by Imran Hussain at 2019-03-10T14:26:56Z
Renewal sender func does some logging and tells people its been run

- - - - -


2 changed files:

- + renewal-notify-email
- sucsam.py


Changes:

=====================================
renewal-notify-email
=====================================
@@ -0,0 +1,7 @@
+{$adminname} has sent out renewal emails to:
+
+{$peoples}
+
+--
+The SUCS Account Manager
+https://projects.sucs.org/sucs/accountmanager
\ No newline at end of file


=====================================
sucsam.py
=====================================
@@ -91,13 +91,31 @@ def sendReminderEmail(listofpeeps):
 			smtpConn.sendmail(sender, receiver, message.as_string())
 			smtpConn.quit()
 
-			print("Sent reminder email to " + username + " on" + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
+			print("Sent reminder email to " + username + " on " + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
 
 			if debugmode > 0:  # only send out one email instead of 85464684164864165
 				sys.exit(0)
 		else:
 			print("Renewal email template not found!")
 			sys.exit(4)
+	if debugmode == 0:
+			file = codecs.open("renewal-notify-email", encoding='utf-8')
+			data = file.read()
+			file.close()
+			data = data.replace("{$adminname}",adminname)
+			data = data.replace("{$peoples}",str(listofpeeps))
+			sender = "staff at sucs.org"
+			receiver = ["exec at sucs.org","logs at sucs.org"]
+			message = MIMEMultipart()
+			message['From'] = sender
+			message['To'] = receiver
+			message['Subject'] = 'Renewal Reminder Sent Out'
+			messageBody = MIMEText(data, 'plain', "UTF-8")
+			message.attach(messageBody)
+
+			smtpConn = smtplib.SMTP('localhost')
+			smtpConn.sendmail(sender, receiver, message.as_string())
+			smtpConn.quit()
 
 
 def mainMenu():



View it on GitLab: https://projects.sucs.org/sucs/accountmanager/commit/99dc95908647e88cb17fecbcb1ae20aeb22a4c08

-- 
View it on GitLab: https://projects.sucs.org/sucs/accountmanager/commit/99dc95908647e88cb17fecbcb1ae20aeb22a4c08
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/devel/attachments/20190310/9a88732a/attachment-0001.html>


More information about the Devel mailing list