08/11/2022 - 11h
parent
363fcfcc1f
commit
51e4f94853
|
@ -268,7 +268,7 @@ def GetActiveSessionFormation_List(diction):
|
||||||
myquery['session_status'] = "true"
|
myquery['session_status'] = "true"
|
||||||
|
|
||||||
|
|
||||||
#print(" ##### myquery = "+str(myquery))
|
print(" ##### myquery = "+str(myquery))
|
||||||
RetObject = []
|
RetObject = []
|
||||||
|
|
||||||
for retval in coll_session.find(myquery):
|
for retval in coll_session.find(myquery):
|
||||||
|
|
|
@ -683,7 +683,11 @@ def createOrder(diction):
|
||||||
if ret_val and ret_val.inserted_id:
|
if ret_val and ret_val.inserted_id:
|
||||||
#print( "str(new_data['invoice_email']) = "+str(new_data['invoice_email']))
|
#print( "str(new_data['invoice_email']) = "+str(new_data['invoice_email']))
|
||||||
# Envoie de l'email
|
# Envoie de l'email
|
||||||
email.SalesOrderConfirmationEmail(str(new_data['invoice_email']), new_data )
|
local_status, message = email.SalesOrderConfirmationEmail(str(new_data['invoice_email']), new_data )
|
||||||
|
if( local_status is False):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + "Impossible de créer la commande "+str(message))
|
||||||
|
return False, "Impossible de créer la commande ", None
|
||||||
|
|
||||||
# Mise à jour du partenaire (ajouter le nouveau pack)
|
# Mise à jour du partenaire (ajouter le nouveau pack)
|
||||||
if ("pack" in diction.keys()):
|
if ("pack" in diction.keys()):
|
||||||
|
|
|
@ -109,7 +109,7 @@ def incription_training_confirmation_mail(diction):
|
||||||
msg.set_content(sourceHtml, subtype='html')
|
msg.set_content(sourceHtml, subtype='html')
|
||||||
|
|
||||||
|
|
||||||
msg['From'] = 'cbalde@mysy-training.com'
|
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||||
msg['Cc'] = 'contact@mysy-training.com'
|
msg['Cc'] = 'contact@mysy-training.com'
|
||||||
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
msg['Subject'] = '[MySy Training]: Confirmation inscription formation'
|
||||||
msg['To'] = str(diction['email'])
|
msg['To'] = str(diction['email'])
|
||||||
|
@ -159,11 +159,9 @@ def Pre_incription_training_confirmation_mail(diction):
|
||||||
msg = MIMEMultipart("alternative")
|
msg = MIMEMultipart("alternative")
|
||||||
|
|
||||||
msg['Subject'] = 'MySy Training : pre-inscription formation'
|
msg['Subject'] = 'MySy Training : pre-inscription formation'
|
||||||
msg['From'] = 'contact@mysy-training.com'
|
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||||
msg['To'] = str(diction['email'])
|
msg['To'] = str(diction['email'])
|
||||||
|
|
||||||
to = [{"email": str(diction['email'])}]
|
|
||||||
bcc = [{"email": "contact@mysy-training.com"}]
|
|
||||||
|
|
||||||
print(" ### Adresse = "+str(diction['adresse']) )
|
print(" ### Adresse = "+str(diction['adresse']) )
|
||||||
"""send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=2, params={ "nom": str(diction['nom']),
|
"""send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(template_id=2, params={ "nom": str(diction['nom']),
|
||||||
|
@ -182,7 +180,7 @@ def Pre_incription_training_confirmation_mail(diction):
|
||||||
# JINJA2
|
# JINJA2
|
||||||
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
templateLoader = jinja2.FileSystemLoader(searchpath="./")
|
||||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||||
TEMPLATE_FILE = "Template/MySy_confirmation_inscription_formation_tpl.html"
|
TEMPLATE_FILE = "Template/MySy_confirmation_Pre_inscription_formation.html"
|
||||||
template = templateEnv.get_template(TEMPLATE_FILE)
|
template = templateEnv.get_template(TEMPLATE_FILE)
|
||||||
# This data can come from database query
|
# This data can come from database query
|
||||||
body = {
|
body = {
|
||||||
|
@ -199,7 +197,7 @@ def Pre_incription_training_confirmation_mail(diction):
|
||||||
|
|
||||||
msg.set_content(sourceHtml, subtype='html')
|
msg.set_content(sourceHtml, subtype='html')
|
||||||
|
|
||||||
msg['From'] = 'cbalde@mysy-training.com'
|
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||||
msg['Cc'] = 'contact@mysy-training.com'
|
msg['Cc'] = 'contact@mysy-training.com'
|
||||||
msg['Subject'] = '[MySy Training] : pre-inscription formation'
|
msg['Subject'] = '[MySy Training] : pre-inscription formation'
|
||||||
msg['To'] = str(diction['email'])
|
msg['To'] = str(diction['email'])
|
||||||
|
|
17
email_mgt.py
17
email_mgt.py
|
@ -1,10 +1,12 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
|
from email.message import EmailMessage
|
||||||
|
from email.mime.base import MIMEBase
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.mime.base import MIMEBase
|
|
||||||
from email import encoders
|
from email import encoders
|
||||||
from email.message import EmailMessage
|
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -1069,6 +1071,12 @@ def SalesOrderConfirmationEmail(account_mail, diction):
|
||||||
msg['To'] = str(mail_recever)
|
msg['To'] = str(mail_recever)
|
||||||
msg['Cc'] = 'contact@mysy-training.com'
|
msg['Cc'] = 'contact@mysy-training.com'
|
||||||
|
|
||||||
|
msg.add_attachment('./Template/MySy_CGV.pdf')
|
||||||
|
with open('./Template/MySy_CGV.pdf', 'rb') as content_file:
|
||||||
|
content = content_file.read()
|
||||||
|
msg.add_attachment(content, maintype='application', subtype='pdf', filename='MySy_CGV.pdf')
|
||||||
|
|
||||||
|
|
||||||
# html_mime = MIMEText(html, 'html')
|
# html_mime = MIMEText(html, 'html')
|
||||||
|
|
||||||
# msg.attach(texte_mime)
|
# msg.attach(texte_mime)
|
||||||
|
@ -1080,14 +1088,13 @@ def SalesOrderConfirmationEmail(account_mail, diction):
|
||||||
smtpserver.send_message(msg)
|
smtpserver.send_message(msg)
|
||||||
smtpserver.close()
|
smtpserver.close()
|
||||||
|
|
||||||
return True
|
return True, " Creation commande OK"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
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))
|
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False
|
return False, " Impossible de créer la commande "
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue