14/08/22 - 19h30
parent
b51d09b404
commit
7b60ba246c
|
@ -21,6 +21,12 @@ YTUBES_CONNECTION_STRING = "mongodb://localhost:27017/"
|
|||
YTUBES_client = MongoClient(YTUBES_CONNECTION_STRING)
|
||||
YTUBES_dbname = YTUBES_client['mysyvideodb']
|
||||
|
||||
"""
|
||||
Cette variable definit l'environnement de travail
|
||||
"""
|
||||
|
||||
#MYSY_ENV = "PROD"
|
||||
MYSY_ENV = "DEV"
|
||||
|
||||
|
||||
'''
|
||||
|
@ -110,4 +116,11 @@ HELP_WORD_QUERY_LIMIT = 3
|
|||
'''
|
||||
Les formats d'image accepté
|
||||
'''
|
||||
IMG_FORMAT=['jpg', 'jpeg', 'png', 'jpe']
|
||||
IMG_FORMAT=['jpg', 'jpeg', 'png', 'jpe']
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Sendinblue clea API
|
||||
'''
|
||||
SENDINBLUE_API_KEY = "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"
|
607
email_mgt.py
607
email_mgt.py
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
|
@ -10,6 +11,14 @@ import sys, os
|
|||
import prj_common as mycommon
|
||||
import GlobalVariable as MYSY_GV
|
||||
|
||||
import sib_api_v3_sdk
|
||||
from sib_api_v3_sdk.rest import ApiException
|
||||
|
||||
configuration = sib_api_v3_sdk.Configuration()
|
||||
configuration.api_key['api-key'] = MYSY_GV.SENDINBLUE_API_KEY
|
||||
|
||||
api_instance = sib_api_v3_sdk.TransactionalEmailsApi(sib_api_v3_sdk.ApiClient(configuration))
|
||||
|
||||
locale.setlocale(category=locale.LC_ALL, locale='fr_FR.utf8')
|
||||
|
||||
|
||||
|
@ -38,103 +47,24 @@ def send_user_account_mail(message, account_mail):
|
|||
msg['Subject'] = 'MySy Training : Activez votre compte '
|
||||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(account_mail)
|
||||
to = [{"email":str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
my_url = ""
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
my_url = "https://www.mysy-training.com/myclass/api/valide_user_account/"+str(message)
|
||||
elif (MYSY_GV.MYSY_ENV == "DEV"):
|
||||
my_url = "http://localhost:5000/myclass/api/valide_user_account/"+str(message)
|
||||
|
||||
|
||||
html = '''
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
|
||||
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
|
||||
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
|
||||
</div>
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
|
||||
<div style="width:100%">
|
||||
<div style="text-align:left;">
|
||||
Bonjour
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1.2rem;">
|
||||
Vous avez fait une demande de création de profil sur<font color="green"> mysy-training.com.</font> <br>
|
||||
Pour activer votre compte, veuillez cliquer sur le lien ci-dessous :
|
||||
<br/><br/>
|
||||
<div style="background-color:#1962AB;width:20%;text-align:center;margin-left:auto; margin-right:auto;">
|
||||
<b> <a href="https://apimysy.iexercice.com/myclass/api/valide_user_account/{objId}" target="_blank" style="color: white;">
|
||||
CLIQUEZ ICI
|
||||
|
||||
</a>
|
||||
</b>
|
||||
|
||||
ou
|
||||
<b> <a href="http://localhost:5000/myclass/api/valide_user_account/{objId}" target="_blank" style="color: white;">
|
||||
CLIQUEZ ICI (local)
|
||||
|
||||
</a>
|
||||
</b>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<br/>
|
||||
NB :
|
||||
<ul>
|
||||
<li>Si vous n'arrivez pas jusqu'au bout de la procédure d'inscription, il faudra recommencer l'inscription depuis le début (le lien d’activation n'est valable que pour la procédure en cours). </li>
|
||||
<li> Si vous n'avez pas demandé l'ouverture d'un compte MYSY Training veuillez ignorer cet e-mail.</li>
|
||||
<li> Si vous avez des questions ou des commentaires, contactez-nous sur les plateformes suivantes :
|
||||
<a href="https://www.facebook.com/MySy-Training-114572794561371/" target="_blank" >
|
||||
Facebook
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/" target="_blank" >
|
||||
LinkedIn
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/in/mysy-training-96b53a237/" target="_blank" >
|
||||
Twitter
|
||||
</a>
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=15, params={"mysyurl": my_url,
|
||||
"user_name": str(account_mail),
|
||||
"id": "122CSR_id"}, to=to, bcc=bcc
|
||||
)
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<br/>
|
||||
|
||||
<p>Cordialement<br>
|
||||
MySy Training Technology<br>
|
||||
Contact : +337 69 20 39 45<br>
|
||||
Email : contact@mysy-training.com<br>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:0.9rem;">
|
||||
|
||||
Ce mail a été envoyé à : {destinataire}"
|
||||
Ce mail vous est adressé par MYSY Training dont le siège social est situé au 1 Cr du Havre, 75008 Paris.
|
||||
Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978 modifiée et au Règlement Général sur la Protection des Données Règlement (UE) 2016/679 du Parlement européen et du Conseil du 27 avril 2016 dit RGPD, vous disposez d'un droit d'accès, de rectification, d'effacement, de limitation et d'opposition au traitement de vos données. Vous pouvez exercer vos droits par courrier postal envoyé à : MYSY Training 1 Cr du Havre, 75008 Paris ou par mail : contact@mysy-training.com.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''.format(code=tomorrow_day, objId=message, destinataire=account_mail)
|
||||
|
||||
|
||||
html_mime = MIMEText(html, 'html')
|
||||
|
||||
# msg.attach(texte_mime)
|
||||
msg.attach(html_mime)
|
||||
|
||||
print("html_mime ="+str(html))
|
||||
|
||||
toaddr = str(account_mail)
|
||||
cc = ['contact@mysy-training.com']
|
||||
toaddrs = [toaddr] + cc
|
||||
|
||||
# msg.attach(MIMEText(open(filename).read()))
|
||||
|
||||
with smtplib.SMTP(smtp_address, port) as server:
|
||||
server.starttls() # Secure the connection
|
||||
|
||||
server.login(user, password)
|
||||
server.sendmail(sender, toaddrs, msg.as_string())
|
||||
mycommon.myprint("mail successfully sent to "+str(toaddrs))
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
print(api_response)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -143,7 +73,6 @@ Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
||||
|
||||
'''
|
||||
Cette fonction envoie un mail de remerciement apres l'activation
|
||||
du compte d'un utilisateur
|
||||
|
@ -163,104 +92,23 @@ def send_user_thks_mail(message, account_mail):
|
|||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(account_mail)
|
||||
|
||||
html = '''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="http://88.170.110.220/mysy_css/mysy_css.css">
|
||||
</head>
|
||||
<body>
|
||||
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
|
||||
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
|
||||
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
|
||||
</div>
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
|
||||
<div style="width:100%">
|
||||
<div style="text-align:left;" class="p">
|
||||
Bonjour
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1.2rem;">
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
Vous venez d'activer votre compte sur le moteur de recherche <font color="green">MySy-Training</font>. <br>
|
||||
le processus de création de compte sur mysy-training.com s'est déroulé avec succès.<br/>
|
||||
<p>
|
||||
Pour accéder aux services proposés par MYSY Training, vous pouvez vous connecter en utilisant votre adresse mail et votre mot de passe.<br/>
|
||||
En cas de perte de votre mot de passe, veuillez utiliser la fonction « MOT DE PASSE OUBLIE ? » sur la page de connexion et les informations requises seront envoyées à l'adresse électronique que vous avez indiquée lors de l'inscription.<br/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
MySy Training Technology est un moteur de recherche exclusivement dédié à la formation. <br/>
|
||||
Il met le profil de l’utilisateur au cœur du système pour trouver la formation la plus adaptée à sa situation. <br/>
|
||||
Des algorithmes spécifiquement conçus pour le monde de la formation nous permettent d’adresser un large éventail de profils. <br/>
|
||||
Quel que soit votre situation, que vous soyez malvoyant, mal entendant, tout simplement à la recherche de la formation qui prend en compte vos besoins, le moteur de recherche MySy-T est là pour vous.<br/>
|
||||
</p>
|
||||
Cordialement.
|
||||
my_url = ""
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
my_url = "https://www.mysy-training.com/myclass/api/valide_user_account/" + str(message)
|
||||
elif (MYSY_GV.MYSY_ENV == "DEV"):
|
||||
my_url = "http://localhost:5000/myclass/api/valide_user_account/" + str(message)
|
||||
|
||||
<br/>
|
||||
MySy Training Technology<br/>
|
||||
Contact : +337 69 20 39 45<br/>
|
||||
Email : contact@mysy-training.com<br/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
<b> Suivez l'actualité des formations depuis nos medias : <br/>
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=16, params={ "user_name": str(account_mail),},
|
||||
to=to, bcc=bcc )
|
||||
|
||||
<a href="https://www.facebook.com/MySy-Training-114572794561371/" target="_blank" >
|
||||
Facebook
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/" target="_blank" >
|
||||
LinkedIn
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/in/mysy-training-96b53a237/" target="_blank" >
|
||||
Twitter
|
||||
</a>
|
||||
|
||||
</b>
|
||||
</div>
|
||||
</font>
|
||||
<br/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:0.9rem;">
|
||||
|
||||
Ce mail a été envoyé à : {destinataire}"
|
||||
Ce mail vous est adressé par MYSY Training dont le siège social est situé au 1 Cr du Havre, 75008 Paris.
|
||||
Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978 modifiée et au Règlement Général sur la Protection des Données Règlement (UE) 2016/679 du Parlement européen et du Conseil du 27 avril 2016 dit RGPD, vous disposez d'un droit d'accès, de rectification, d'effacement, de limitation et d'opposition au traitement de vos données. Vous pouvez exercer vos droits par courrier postal envoyé à : MYSY Training 1 Cr du Havre, 75008 Paris ou par mail : contact@mysy-training.com.
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>'''.format(code=tomorrow_day, objId=message, destinataire=account_mail)
|
||||
|
||||
html_mime = MIMEText(html, 'html')
|
||||
|
||||
# msg.attach(texte_mime)
|
||||
msg.attach(html_mime)
|
||||
|
||||
print("html_mime =" + str(html))
|
||||
|
||||
toaddr = str(account_mail)
|
||||
cc = ['contact@mysy-training.com']
|
||||
toaddrs = [toaddr] + cc
|
||||
|
||||
# msg.attach(MIMEText(open(filename).read()))
|
||||
|
||||
with smtplib.SMTP(smtp_address, port) as server:
|
||||
server.starttls() # Secure the connection
|
||||
|
||||
server.login(user, password)
|
||||
server.sendmail(sender, toaddrs, msg.as_string())
|
||||
mycommon.myprint("mail successfully sent to " + str(toaddrs))
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
print(api_response)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -270,7 +118,6 @@ Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978
|
|||
return False, " Impossible d'envoyer l'email de notification "
|
||||
|
||||
|
||||
|
||||
def send_partner_account_mail(message, account_mail):
|
||||
|
||||
try:
|
||||
|
@ -280,6 +127,13 @@ def send_partner_account_mail(message, account_mail):
|
|||
receiver = [str(account_mail)]
|
||||
toaddrs = ", ".join(receiver)
|
||||
|
||||
my_url = ""
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
my_url = "https://www.mysy-training.com/myclass/api/valide_partnair_account/" + str(message)
|
||||
elif (MYSY_GV.MYSY_ENV == "DEV"):
|
||||
my_url = "http://localhost:5000/myclass/api/valide_partnair_account/"+str(message)
|
||||
|
||||
|
||||
print(" mail enoye à toaddrs : "+toaddrs)
|
||||
|
||||
|
||||
|
@ -293,129 +147,17 @@ def send_partner_account_mail(message, account_mail):
|
|||
msg['To'] = str(toaddrs)
|
||||
msg['Cc'] = 'contact@mysy-training.com'
|
||||
|
||||
print(" mail enoye à toaddrs : " + str(msg['To']))
|
||||
|
||||
html = '''
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="http://88.170.110.220/mysy_css/mysy_css.css">
|
||||
</head>
|
||||
<body>
|
||||
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
|
||||
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
|
||||
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
|
||||
</div>
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
|
||||
<div style="width:100%">
|
||||
<div style="text-align:left;" class="p">
|
||||
Bonjour
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1.2rem;">
|
||||
|
||||
Vous venez de créer votre <font color="red"> compte PRO </font> sur le moteur de recherche <font color="green">MySy-Training</font>. <br>
|
||||
le processus de création du <font color="red"> compte PRO </font> sur mysy-training.com s'est déroulé avec succès.<br/>
|
||||
<p>
|
||||
La securité des vos données est primordiale pour nous. Une fois que vous aurez activez votre compte vous allez recevoir :
|
||||
<li>
|
||||
Une clé secrète </li>
|
||||
<li>
|
||||
Un nouveau mot de passe. Nous vous invitons à changer ce mot de passe depuis votre nouvelle espace PRO.
|
||||
</li>
|
||||
|
||||
</p>
|
||||
Pour activer votre compte, veuillez cliquer sur le lien ci-dessous :
|
||||
<br/><br/>
|
||||
<div style="background-color:#1962AB;width:20%;text-align:center;margin-left:auto; margin-right:auto;">
|
||||
<b> <a href="https://apimysy.iexercice.com/myclass/api/valide_partnair_account/{objId}" target="_blank" style="color: white;">
|
||||
CLIQUEZ ICI
|
||||
|
||||
</a>
|
||||
</b>
|
||||
</div>
|
||||
|
||||
<br/><br/>
|
||||
<div style="background-color:#1962AB;width:20%;text-align:center;margin-left:auto; margin-right:auto;">
|
||||
<b> <a href="http://127.0.0.1:5000/myclass/api/valide_partnair_account/{objId}" target="_blank" style="color: white;">
|
||||
CLIQUEZ ICI (local)
|
||||
|
||||
</a>
|
||||
</b>
|
||||
</div>
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
|
||||
<p>
|
||||
Important : Pour vous connecter entant que PRO sur le site mysy-training.com, la clé secrete et le mot de passe sont necessaires.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Merci d'avoir rejoint MySy.
|
||||
Cordialement.
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
MySy Training Technology<br/>
|
||||
Contact : +337 69 20 39 45<br/>
|
||||
Email : contact@mysy-training.com<br/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
<b> Suivez l'actualité des formations depuis nos medias : <br/>
|
||||
|
||||
<a href="https://www.facebook.com/MySy-Training-114572794561371/" target="_blank" >
|
||||
Facebook
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/" target="_blank" >
|
||||
LinkedIn
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/in/mysy-training-96b53a237/" target="_blank" >
|
||||
Twitter
|
||||
</a>
|
||||
|
||||
</b>
|
||||
</div>
|
||||
</font>
|
||||
<br/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:0.9rem;">
|
||||
|
||||
Ce mail a été envoyé à : {destinataire}"
|
||||
Ce mail vous est adressé par MYSY Training dont le siège social est situé au 1 Cr du Havre, 75008 Paris.
|
||||
Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978 modifiée et au Règlement Général sur la Protection des Données Règlement (UE) 2016/679 du Parlement européen et du Conseil du 27 avril 2016 dit RGPD, vous disposez d'un droit d'accès, de rectification, d'effacement, de limitation et d'opposition au traitement de vos données. Vous pouvez exercer vos droits par courrier postal envoyé à : MYSY Training 1 Cr du Havre, 75008 Paris ou par mail : contact@mysy-training.com.
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
'''.format(code=tomorrow_day, objId=message, destinataire=account_mail)
|
||||
|
||||
html_mime = MIMEText(html, 'html')
|
||||
|
||||
# msg.attach(texte_mime)
|
||||
msg.attach(html_mime)
|
||||
|
||||
print("html_mime ="+str(html))
|
||||
|
||||
|
||||
with smtplib.SMTP(smtp_address, port) as server:
|
||||
server.starttls() # Secure the connection
|
||||
|
||||
server.login(user, password)
|
||||
server.sendmail(sender, toaddrs, msg.as_string())
|
||||
print("mail successfully sent")
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=17, params={"mysyurl": my_url,
|
||||
"user_name": str(account_mail),
|
||||
}, to=to, bcc=bcc
|
||||
)
|
||||
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
print(api_response)
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
|
@ -442,70 +184,25 @@ def send_user_init_pwd_mail(token, account_mail):
|
|||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(account_mail)
|
||||
|
||||
html = '''
|
||||
my_url = ""
|
||||
if (MYSY_GV.MYSY_ENV == "PROD"):
|
||||
my_url = "https://www.mysy-training.com/ResetUserPwd/" + str(token)
|
||||
elif (MYSY_GV.MYSY_ENV == "DEV"):
|
||||
my_url = "http://localhost:3009/ResetUserPwd/" + str(token)
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
|
||||
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
|
||||
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
|
||||
</div>
|
||||
<div style="padding:20px 0px;text-align:center;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
|
||||
<div style="width:100%">
|
||||
<div style="text-align:center;">
|
||||
Bonjour
|
||||
<div style="padding:20px 0px;text-align:center;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1.2rem;">
|
||||
|
||||
Nous avons reçu une demande de réinitialisation du mot de passe de votre compte <font color="green">MySy-Training</font>.<br/>
|
||||
Veuillez cliquer sur le bouton ci-dessous pour le réinitialiser.
|
||||
. <br/>
|
||||
|
||||
<br/>
|
||||
<div style="background-color:#1962AB;width:20%;text-align:center;margin-left:auto; margin-right:auto;">
|
||||
<b> <a href="https://www.mysy-training.com/ResetUserPwd/{objId}" target="_blank" style="color: white;">
|
||||
Changez de mot de passe
|
||||
|
||||
</a>
|
||||
</b>
|
||||
</div>
|
||||
</font>
|
||||
<br/>
|
||||
|
||||
|
||||
<p>Cordialement<br>
|
||||
MySy Training Technology<br>
|
||||
Contact : +337 69 20 39 45<br>
|
||||
Email : contact@mysy-training.com<br>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=19, params={"mysyurl": my_url,
|
||||
"user_name": str(account_mail),
|
||||
}, to=to, bcc=bcc
|
||||
)
|
||||
|
||||
'''.format(code=tomorrow_day, objId=token)
|
||||
|
||||
html_mime = MIMEText(html, 'html')
|
||||
|
||||
# msg.attach(texte_mime)
|
||||
msg.attach(html_mime)
|
||||
|
||||
print("html_mime =" + str(html))
|
||||
|
||||
toaddr = str(account_mail)
|
||||
cc = ['contact@mysy-training.com']
|
||||
toaddrs = [toaddr] + cc
|
||||
|
||||
# msg.attach(MIMEText(open(filename).read()))
|
||||
|
||||
with smtplib.SMTP(smtp_address, port) as server:
|
||||
server.starttls() # Secure the connection
|
||||
|
||||
server.login(user, password)
|
||||
server.sendmail(sender, toaddrs, msg.as_string())
|
||||
mycommon.myprint("mail successfully sent to " + str(toaddrs))
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
print(api_response)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -529,71 +226,22 @@ def send_user_delete_account(token, account_mail):
|
|||
msg['From'] = 'contact@mysy-training.com'
|
||||
msg['To'] = str(account_mail)
|
||||
|
||||
html = '''
|
||||
my_url = ""
|
||||
if( MYSY_GV.MYSY_ENV == "PROD"):
|
||||
my_url = "https://www.mysy-training.com/DeleteUserAccount/" + str(token)
|
||||
elif (MYSY_GV.MYSY_ENV == "DEV"):
|
||||
my_url = "http://localhost:3009/DeleteUserAccount/" + str(token)
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
|
||||
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
|
||||
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
|
||||
</div>
|
||||
<div style="padding:20px 0px;text-align:center;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
|
||||
<div style="width:100%">
|
||||
<div style="text-align:center;">
|
||||
Bonjour
|
||||
<div style="padding:20px 0px;text-align:center;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1.2rem;">
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
Nous avons reçu une demande de suppression de votre compte <font color="green">MySy-Training</font>.<br/>
|
||||
Si vous n'etes pas l'auteur de la demande, merci de contacter le service support de MySy.
|
||||
. <br/>
|
||||
Le échéant, vous pouvez finaliser la suppression de votre compte en cliquant sur le lien ci-dessous.<br/>
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=20, params={"mysyurl": my_url,
|
||||
"user_name": str(account_mail),
|
||||
}, to=to, bcc=bcc
|
||||
)
|
||||
|
||||
<font color="red">Important : Cette action entrenerait la suppresion definitive de vos information.</font>
|
||||
<br/>
|
||||
<div style="background-color:#1962AB;width:20%;text-align:center;margin-left:auto; margin-right:auto;">
|
||||
<b> <a href="https://www.mysy-training.com/DeleteUserAccount/{objId}" target="_blank" style="color: white;">
|
||||
Changez de mot de passe
|
||||
|
||||
</a>
|
||||
</b>
|
||||
</div>
|
||||
</font>
|
||||
<br/>
|
||||
|
||||
<p>Cordialement<br>
|
||||
MySy Training Technology<br>
|
||||
Contact : +337 69 20 39 45<br>
|
||||
Email : contact@mysy-training.com<br>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
'''.format(code=tomorrow_day, objId=token)
|
||||
|
||||
html_mime = MIMEText(html, 'html')
|
||||
|
||||
# msg.attach(texte_mime)
|
||||
msg.attach(html_mime)
|
||||
|
||||
print("html_mime =" + str(html))
|
||||
|
||||
toaddr = str(account_mail)
|
||||
cc = ['contact@mysy-training.com']
|
||||
toaddrs = [toaddr] + cc
|
||||
|
||||
# msg.attach(MIMEText(open(filename).read()))
|
||||
|
||||
with smtplib.SMTP(smtp_address, port) as server:
|
||||
server.starttls() # Secure the connection
|
||||
|
||||
server.login(user, password)
|
||||
server.sendmail(sender, toaddrs, msg.as_string())
|
||||
mycommon.myprint("mail successfully sent to " + str(toaddrs))
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
print(api_response)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -696,107 +344,14 @@ def Pro_Account_Token_Pass(account_mail, my_token):
|
|||
cle = my_token
|
||||
|
||||
print(" mail enoye à toaddrs : " + str(msg['To']))
|
||||
html = ''' <!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="http://88.170.110.220/mysy_css/mysy_css.css">
|
||||
</head>
|
||||
<body>
|
||||
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
|
||||
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
|
||||
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
|
||||
</div>
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
|
||||
<div style="width:100%">
|
||||
<div style="text-align:left;" class="p">
|
||||
Bonjour
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1.2rem;">
|
||||
to = [{"email": str(account_mail)}]
|
||||
bcc = [{"email": "contact@mysy-training.com"}]
|
||||
|
||||
Vous venez d'activer votre <font color="red"> compte PRO </font> sur le moteur de recherche <font color="green">MySy-Training</font>. <br>
|
||||
<br>
|
||||
Pour vous connecter et profiter de nos services, voici vos identifiants :
|
||||
<p>
|
||||
send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=18, params={"user_name": str(account_mail), "secrete":str(my_token) },
|
||||
to=to, bcc=bcc)
|
||||
|
||||
<li>
|
||||
Email de connexion : l'email de connexion correspond à l'adresse de cette boite email.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Votre clé secrète : {cle} </li>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
url de connexion : https://www.mysy-training.com/PartnerLogin
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
Merci d'avoir rejoint MySy.
|
||||
Cordialement.
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
MySy Training Technology<br/>
|
||||
Contact : +337 69 20 39 45<br/>
|
||||
Email : contact@mysy-training.com<br/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
<b> Suivez l'actualité des formations depuis nos medias : <br/>
|
||||
|
||||
<a href="https://www.facebook.com/MySy-Training-114572794561371/" target="_blank" >
|
||||
Facebook
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/" target="_blank" >
|
||||
LinkedIn
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/in/mysy-training-96b53a237/" target="_blank" >
|
||||
Twitter
|
||||
</a>
|
||||
|
||||
</b>
|
||||
</div>
|
||||
</font>
|
||||
<br/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="padding:20px 0px;text-align:left;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:0.9rem;">
|
||||
|
||||
Ce mail a été envoyé à : {destinataire}"
|
||||
Ce mail vous est adressé par MYSY Training dont le siège social est situé au 1 Cr du Havre, 75008 Paris.
|
||||
Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978 modifiée et au Règlement Général sur la Protection des Données Règlement (UE) 2016/679 du Parlement européen et du Conseil du 27 avril 2016 dit RGPD, vous disposez d'un droit d'accès, de rectification, d'effacement, de limitation et d'opposition au traitement de vos données. Vous pouvez exercer vos droits par courrier postal envoyé à : MYSY Training 1 Cr du Havre, 75008 Paris ou par mail : contact@mysy-training.com.
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
'''.format(code=tomorrow_day, destinataire=account_mail, cle=cle)
|
||||
html_mime = MIMEText(html, 'html')
|
||||
|
||||
# msg.attach(texte_mime)
|
||||
msg.attach(html_mime)
|
||||
|
||||
print("html_mime =" + str(html))
|
||||
|
||||
with smtplib.SMTP(smtp_address, port) as server:
|
||||
server.starttls() # Secure the connection
|
||||
|
||||
server.login(user, password)
|
||||
server.sendmail(sender, toaddrs, msg.as_string())
|
||||
print("mail successfully sent")
|
||||
api_response = api_instance.send_transac_email(send_smtp_email)
|
||||
print(api_response)
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue