'''.format(code=tomorrow_day, objId=message)
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))
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
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
'''
def send_user_thks_mail(message, account_mail):
try:
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
print("debut envoi mail de test ")
# on rentre les renseignements pris sur le site du fournisseur
msg = MIMEMultipart("alternative")
msg['Subject'] = 'MySy Training : Votre compte est actif '
msg['From'] = 'contact@mysy-training.com'
msg['To'] = str(account_mail)
html = '''
Bonjour
Vous venez d'activer votre compte sur le moteur de recherche
MySy-Training.
Merci à vous.
Suivez l'actualité des formations depuis nos medias :
Facebook
LinkedIn
Twitter
© 2022 Mysy Training Technology. Tous droits réservés. MySy Training Technology est une marque déposée.
Mentions légales.
'''.format(code=tomorrow_day, objId=message)
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))
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
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 "
def send_partner_account_mail(message, account_mail):
try:
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
receiver = ["cherif.balde@yahoo.fr","cbalde@bigben-connected.com",str(account_mail)]
toaddrs = ", ".join(receiver)
print(" mail enoye à : "+toaddrs)
print("debut envoi mail de test ")
# on rentre les renseignements pris sur le site du fournisseur
msg = MIMEMultipart("alternative")
msg['Subject'] = 'MySy : test email activation compte '
msg['From'] = 'contact@mysy-training.com'
msg['To'] = str(toaddrs)
msg['Cc'] = 'cbalde@mysy-training.com'
html = '''
Bonjour
Vous venez de créer un compte partenaire.
Pour activier votre compte, merci de cliquer ici
https://apimysy.iexercice.com/myclass/api/valide_partnair_account/{objId}
ou
http://127.0.0.1:5000/myclass/api/valide_partnair_account/{objId}
Cordialement
L'equipe informatique de MySy
'''.format(code=tomorrow_day, objId=message)
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")
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
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"
'''
Envoie de l'email de reinitialisation du mot de passe du user
'''
def send_user_init_pwd_mail(token, account_mail):
try:
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
print("debut envoi mail de test ")
# on rentre les renseignements pris sur le site du fournisseur
msg = MIMEMultipart("alternative")
msg['Subject'] = '[MySy Training Technology] : Reinitialisez votre mot de passe'
msg['From'] = 'contact@mysy-training.com'
msg['To'] = str(account_mail)
html = '''
Bonjour
Nous avons reçu une demande de réinitialisation du mot de passe de votre compte
MySy-Training.
Veuillez cliquer sur le bouton ci-dessous pour le réinitialiser.
.
Cordialement
MySy Training Technology
Contact : +337 69 20 39 45
Email : contact@mysy-training.com
'''.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))
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
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 "
'''
Envoie de l'email de suppression du compte utilisateur
'''
def send_user_delete_account(token, account_mail):
try:
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
msg = MIMEMultipart("alternative")
msg['Subject'] = '[MySy Training Technology] : Suppression de votre'
msg['From'] = 'contact@mysy-training.com'
msg['To'] = str(account_mail)
html = '''
Bonjour
Nous avons reçu une demande de suppression de votre compte
MySy-Training.
Si vous n'etes pas l'auteur de la demande, merci de contacter le service support de MySy.
.
Le échéant, vous pouvez finaliser la suppression de votre compte en cliquant sur le lien ci-dessous.
Important : Cette action entrenerait la suppresion definitive de vos information.
Cordialement
MySy Training Technology
Contact : +337 69 20 39 45
Email : contact@mysy-training.com
'''.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))
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
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 envoir n'import quel email avec les varibable :
- recever_email
- objet_mail
- message_mail
'''
def SendGenericEmail(mail_recever=None, mail_object=None, mail_message=None):
try:
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
print("debut envoi mail de test ")
# on rentre les renseignements pris sur le site du fournisseur
msg = MIMEMultipart("alternative")
msg['Subject'] = '[MySy Training Technology] : '+str(mail_object)
msg['From'] = MYSY_GV.INTERNAL_MAIL_SENDER
msg['To'] = str(mail_recever)
html = '''
Bonjour
Message de MySy-Training Technology .
{mymessage}
'''.format(mymessage=mail_message)
html_mime = MIMEText(html, 'html')
# msg.attach(texte_mime)
msg.attach(html_mime)
print("html_mime =" + str(html))
toaddr = str(mail_recever)
cc = ['cbalde@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))
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False