[SUCS Devel] [Git][sucs/accountmanager][master] Add Emoji (unicode/utf-8) support in reminder emails 🙂

Imran Hussain imranh at sucs.org
Sat Mar 9 16:43:55 GMT 2019


Imran Hussain pushed to branch master at sucs / accountmanager


Commits:
34b23bc4 by Imran Hussain at 2019-03-09T16:42:50Z
Add Emoji (unicode/utf-8) support in reminder emails 🙂

- - - - -


1 changed file:

- sucsam.py


Changes:

=====================================
sucsam.py
=====================================
@@ -6,6 +6,7 @@ import sys
 import readline
 import psycopg2
 import datetime
+import codecs
 import smtplib
 from email.mime.multipart import MIMEMultipart
 from email.mime.text import MIMEText
@@ -64,14 +65,15 @@ def sendReminderEmail(listofpeeps):
 		adminname = pwd.getpwuid(os.geteuid())[0]
 
 		if os.path.isfile(str(type)+"-email"):
-			file = open(str(type)+"-email","r")
+			#file = open(str(type)+"-email","r")
+			file = codecs.open(str(type)+"-email", encoding='utf-8')
 			data = file.read()
 			file.close()
 			data = data.replace("{$realname}",realname)
 			data = data.replace("{$username}",username)
 			data = data.replace("{$adminname}",adminname)
 			sender = 'staff at sucs.org'
-			if debugmode > 0
+			if debugmode > 0:
 				receiver = 'imranh at sucs.org'
 			else:
 				receiver = email
@@ -79,7 +81,7 @@ def sendReminderEmail(listofpeeps):
 			message['From'] = sender
 			message['To'] = receiver
 			message['Subject'] = 'Your SUCS account is due for renewal'
-			messageBody = MIMEText(data, 'plain')
+			messageBody = MIMEText(data, 'plain', "UTF-8")
 			message.attach(messageBody)
 
 			smtpConn = smtplib.SMTP('localhost')



View it on GitLab: https://projects.sucs.org/sucs/accountmanager/commit/34b23bc48a728ffdfcfe927868d16b3bc625f597

-- 
View it on GitLab: https://projects.sucs.org/sucs/accountmanager/commit/34b23bc48a728ffdfcfe927868d16b3bc625f597
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/20190309/cb299113/attachment-0001.html>


More information about the Devel mailing list