Skip to content
Snippets Groups Projects
Commit 34b23bc4 authored by Imran Hussain's avatar Imran Hussain
Browse files

Add Emoji (unicode/utf-8) support in reminder emails :slight_smile:

parent 227424e1
No related branches found
No related tags found
No related merge requests found
......@@ -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@sucs.org'
if debugmode > 0
if debugmode > 0:
receiver = 'imranh@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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment