Skip to content

Commit 8917ef5

Browse files
author
Jesson Soto Ventura
committed
moved branches
1 parent 8b34ba9 commit 8917ef5

File tree

3 files changed

+17
-31
lines changed

3 files changed

+17
-31
lines changed

api/API/files.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@ def removeFiles(username):
2424

2525

2626

27-
def create_message(username_email):
27+
def create_message(username_email, body):
2828
'''
2929
Parameters:
3030
username_email(s) - Emails of the recipients
31+
body - The body of the email
3132
'''
3233
msg = Message("Subject",
33-
34+
sender=app.config['MAIL_USERNAME'],
3435
recipients=[username_email]) #create a message instance
35-
msg.html = '<b>HTML</b> body'
36+
msg.html = body
3637
return msg
37-
38-
39-

api/chair/awardLetters.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from ..API.committee import addCommitteeMembers, removeCommitteeMembers, getCommitteeMembers
55
from ..API.faculty import getFacultyWithAcceptedProjects
66
from ..API.budget import getTotalBudget
7+
from ..API.files import create_message
78

89

910
from ..pages import *
@@ -60,7 +61,6 @@ def awardLetters_generate(username,pID):
6061
if not g.user.isCommitteeMember:
6162
abort(403)
6263
# All of our queries
63-
print(pID)
6464
project = Projects.get(Projects.pID == pID)
6565
# we need the current year to get current faculty with projects
6666
template = EmailTemplates.get(EmailTemplates.eID == 1)
@@ -80,19 +80,8 @@ def awardLetters_generate(username,pID):
8080
body = body.replace("@@Start Date@@",start)
8181
body = body.replace("@@End Date@@",end)
8282
body = body.replace("@@Stipend@@",stipend)
83-
84-
mail_to = "mailto:%[email protected]?subject=%s&body=%s" % (username, subject, body)
85-
86-
#Replace common html tags to ascii hex values
87-
mail_to = mail_to.replace("&nbsp;"," ")
88-
mail_to = mail_to.replace("&ldquo;","%22")
89-
mail_to = mail_to.replace("&rdquo;","%22")
90-
mail_to = mail_to.replace("&rsquo;","%27")
91-
mail_to = mail_to.replace(" ", "%20")
92-
mail_to = mail_to.replace("\n", "%0A")
93-
mail_to = mail_to.replace("<p>","")
94-
mail_to = mail_to.replace("</p>","%0A")
95-
83+
acceptance_email = create_message("%[email protected]" % (username), body)
84+
mail.send(acceptance_email)
85+
mail_to = "JESSON IS HERE"
86+
9687
return jsonify({"mail_to": mail_to})
97-
98-

api/chair/email_accepted.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,32 @@ def emailProjects_GET ():
1212
# All of our queries
1313
# we need the current year to get current faculty with projects
1414
currentCycle = getCurrentParameters()
15-
15+
1616
faculty = getFacultyWithProjects(currentCycle.year)
17-
17+
1818
return render_template ( "chair/allProjects.html",
1919
username = g.user.username,
2020
cfg = cfg,
2121
fac = faculty,
2222
)
23-
23+
2424
@app.route("/email")
2525
def email():
2626
'''this route is for testing purposes'''
2727
my_email="[email protected]"
28-
print("I AM SENDING THINGS")
2928
msg = create_message(my_email)
3029
mail.send(msg)
3130
return "Message is sent."
32-
33-
31+
32+
3433
@app.route("/email/<username>")
3534
@login_required
3635
def view_email(username):
3736
currentCycle = getCurrentParameters()
38-
37+
3938
faculty = getFacultyByYear(username, currentCycle.year)
40-
39+
4140
return render_template("snips/email.html",
4241
person = faculty,
4342
cfg = cfg)
44-
43+

0 commit comments

Comments
 (0)