diff --git a/SE_API/API.py b/SE_API/API.py index 91cfb16..3f6be11 100644 --- a/SE_API/API.py +++ b/SE_API/API.py @@ -19,9 +19,10 @@ from models.Course import Course from models.Project import Project from models.Campus import Campus -#Validation Utils Libs +# All API from SE_API.Validation_Utils import * from SE_API.Respones_Utils import * +from SE_API.Email_Utils import * diff --git a/SE_API/Email_Utils.py b/SE_API/Email_Utils.py new file mode 100644 index 0000000..683f7e8 --- /dev/null +++ b/SE_API/Email_Utils.py @@ -0,0 +1,127 @@ +__author__ = 'sagi' + + +from google.appengine.api import mail + + +def send_validation_email(token, email, name): + emailSuffix = str(email).split('@')[1] + message = mail.EmailMessage(sender="SE-Hub Support ", + subject="SE-Hub Activate Account") + + message.to = email + + message.body = """ + Dear """+name+""": + + To Activate your SE-Hub Account please click on the link below:
+ http://se-hub.appspot.com/api/validation/confirm/"""+token+"""|"""+emailSuffix+""" + to get access to your Campus :) + + Please let us know if you have any questions. + + SE-Hub (c) 2015 niptop Team. + """ + + message.html = """ + +
+
+ + +
+
+
+

Hey """+name+"""- Just one More Step...

+

Dear """+name+""":

+ + To Activate your SE-Hub Account please click on the link below:
+ http://se-hub.appspot.com/api/validation/confirm/"""+token+"""|"""+emailSuffix+""" + + to access you virtual class. +
+

+ Please let us know if you have any questions. +
+ SE-Hub (c) 2015 niptop Team. + + + """ + + message.send() + +def send_create_campus_request(email, name, campus_name): + message = mail.EmailMessage(sender="SE-Hub Support ", + subject="SE-Hub: "+campus_name+" Is Being Evaluated") + + message.to = email + + message.body = """ + Dear """+name+""": + + Thank You For Choosing SE-Hub! + Your Request for creating a new Campus named """+campus_name + """ + is Being Evaluated. + You Will Receive an e-mail When We finish the process
+ + Please let us know if you have any questions. + + SE-Hub (c) 2015 niptop Team. + """ + + message.html = """ + +
+
+ + +
+
+
+

Thank You For Choosing SE-Hub!

+

Dear """+name+""":

+ + Your Request for creating a new Campus named """+campus_name + """ + is Being Evaluated. + You Will Receive an e-mail When We finish the process
+ + to access you virtual class. +
+

+ Please let us know if you have any questions. +
+ SE-Hub (c) 2015 niptop Team. + + + """ + message.send() + + +def notify_se_hub_campus_request(campus, campus_name): + message = mail.EmailMessage(sender="SE-Hub Support ", + subject="SE-Hub: "+campus_name+" Is Being Evaluated") + + message.to = 'se-hub@appspot.gserviceaccount.com' + + message.body = """ + a new Campus request + """+str(campus.to_JSON()) + + message.html = """ + +
+
+ + +
+
+
+

New Campus!

+
+ """ + str(campus.to_JSON()) + """ +
+ SE-Hub (c) 2015 niptop Team. + + + """ + message.send() diff --git a/SE_API/Validation_Utils.py b/SE_API/Validation_Utils.py index e99b2bd..90df681 100644 --- a/SE_API/Validation_Utils.py +++ b/SE_API/Validation_Utils.py @@ -2,7 +2,7 @@ __author__ = 'sagi' from google.appengine.ext import db from models.User import User from models.Campus import Campus -from google.appengine.api import mail + def get_user_by_token(token): @@ -32,50 +32,3 @@ def is_lecturer(token): if user is None: return False return user.isLecturer - - -def send_validation_email(token, email, name): - emailSuffix = str(email).split('@')[1] - message = mail.EmailMessage(sender="SE-Hub Support ", - subject="SE-Hub Activate Account") - - message.to = email - - message.body = """ - Dear """+name+""": - - To Activate your SE-Hub Account please click on the link below:
- http://se-hub.appspot.com/api/validation/confirm/"""+token+"""|"""+emailSuffix+""" - to get access to your Campus :) - - Please let us know if you have any questions. - - SE-Hub (c) 2015 niptop Team. - """ - - message.html = """ - -
-
- - -
-
-
-

Hey """+name+"""- Just one More Step...

-

Dear """+name+""":

- - To Activate your SE-Hub Account please click on the link below:
- http://se-hub.appspot.com/api/validation/confirm/"""+token+"""|"""+emailSuffix+""" - - to access you virtual class. -
-

- Please let us know if you have any questions. -
- SE-Hub (c) 2015 niptop Team. - - - """ - - message.send()