EmailValidation - Copie
EmailValidation - Copie
mport smtplib
import random
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from Config.app import expéditeur, mot_de_passe
from Service.UserServices import UserService
from tkinter import messagebox
from email.mime.image import MIMEImage
from Controller.UserController import UserController
class EmailValidation:
def __init__(self):
self.smtp_server = 'smtp.gmail.com' # Remplacez par votre serveur SMTP
self.smtp_port = 587 # Port SMTP (peut varier selon la configuration)
self.model = UserService()
self.model_user = UserController()
resultat_idPAtrner = self.model_user.Get_IdPArtner_By_IdUser(id)
namePartner = resultat_idPAtrner["NAME"]
iconPartner = resultat_idPAtrner["ICON"]
# Création de l'e-mail
msg = MIMEMultipart('alternative')
msg['From'] = namePartner
msg['To'] = destinataire_email
msg['Subject'] = 'Validation Confirmation'
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="x-apple-disable-message-reformatting">
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--<![endif]-->
<title></title>
<!--[if !mso]><!-->
<link href="https://fonts.googleapis.com/css?family=Cabin:400,700"
rel="stylesheet" type="text/css">
<!--<![endif]-->
</head>
<div
style="font-size: 14px; color: #afb0c7;
line-height: 170%; text-align: center; word-wrap: break-word;">
<p style="font-size: 14px; line-height:
170%;"><span
style="font-size: 14px; line-
height: 23.8px;">You Think We Do!</span></p>
</div>
</td>
</tr>
</tbody>
</table>
<!--[if (!mso)&(!IE)]><!-->
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><!
[endif]-->
</div>
</div>
</div>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:20px;font-family:'Cabin',sans-serif;"
align="left">
{}
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<!--[if (!mso)&(!IE)]><!-->
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><!
[endif]-->
</div>
</div>
</div>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:40px 10px 10px;font-family:'Cabin',sans-serif;"
align="left">
src="https://cdn.templates.unlayer.com/assets/1597218650916-xxxxc.png" alt="Image"
title="Image"
style="outline: none;text-
decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: inline-
block !important;border: none;height: auto;float: none;width: 26%;max-width:
150.8px;"
width="150.8" />
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:10px;font-family:'Cabin',sans-serif;"
align="left">
<div
style="font-size: 14px; color: #e5eaf5;
line-height: 140%; text-align: center; word-wrap: break-word;">
<p style="font-size: 14px; line-height:
140%;"><strong>T H A N K S F O
R S I G N I N G
U P !</strong></p>
</div>
</td>
</tr>
</tbody>
</table>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:0px 10px 31px;font-family:'Cabin',sans-serif;"
align="left">
<div
style="font-size: 14px; color: #e5eaf5;
line-height: 140%; text-align: center; word-wrap: break-word;">
<p style="font-size: 14px; line-height:
140%;"><span
style="font-size: 28px; line-
height: 39.2px;"><strong><span
style="line-height: 39.2px;
font-size: 28px;">Validation Code</span></strong>
</span>
</p>
</div>
</td>
</tr>
</tbody>
</table>
<!--[if (!mso)&(!IE)]><!-->
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><!
[endif]-->
</div>
</div>
</div>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:33px 55px;font-family:'Cabin',sans-serif;"
align="left">
<div
style="font-size: 14px; line-height:
160%; text-align: center; word-wrap: break-word;">
<p style="font-size: 14px; line-height:
160%;"><span
style="font-size: 22px; line-
height: 35.2px;">Hi, </span></p>
<p style="font-size: 14px; line-height:
160%;"><span
style="font-size: 18px; line-
height: 28.8px;">You're almost ready to begin. Here is
your {} SARL, {} validation code.
Please keep this code
confidential!</span></p>
</div>
</td>
</tr>
</tbody>
</table>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:10px;font-family:'Cabin',sans-serif;"
align="left">
<div align="center">
<!--[if mso]><v:roundrect
xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-
com:office:word" href="" style="height:46px; v-text-anchor:middle; width:162px;"
arcsize="8.5%" stroke="f" fillcolor="#ff6600"><w:anchorlock/><center
style="color:#FFFFFF;"><![endif]-->
<a href="" target="_blank" class="v-
button"
style="box-sizing: border-box;display:
inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align:
center;color: #FFFFFF; background-color: #ff6600; border-radius: 4px;-webkit-
border-radius: 4px; -moz-border-radius: 4px; width:auto; max-width:100%; overflow-
wrap: break-word; word-break: break-word; word-wrap:break-word;font-size: 14px;">
<span style="display:block;padding:14px
44px 13px;line-height:120%;"><span
style="font-size: 16px; line-
height: 19.2px;"><strong><span
style="line-height: 19.2px;
font-size: 16px;"> {} </span></strong>
</span>
</span>
</a>
<!--[if mso]></center></v:roundrect><!
[endif]-->
</div>
</td>
</tr>
</tbody>
</table>
<!--[if (!mso)&(!IE)]><!-->
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><!
[endif]-->
</div>
</div>
</div>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:41px 55px 18px;font-family:'Cabin',sans-serif;"
align="left">
<div
style="font-size: 14px; color: #003399;
line-height: 160%; text-align: center; word-wrap: break-word;">
<p style="font-size: 14px; line-height:
160%;"><span
style="font-size: 20px; line-
height: 32px;"><strong>For More
Information</strong></span></p>
<p style="font-size: 14px; line-height:
160%;"><span
style="font-size: 16px; line-
height: 25.6px; color: #000000;">Never share your passwords and validation codes
with anyone.
Malicious people could use it to
harm you.</span></p>
<p style="font-size: 14px; line-height:
160%;"><span
style="font-size: 16px; line-
height: 25.6px; color: #000000;">+237 233 478 155 / 652
423 486</span></p>
<p style="font-size: 14px; line-height:
160%;"><span
style="font-size: 16px; line-
height: 25.6px; color: #000000;">www.standardallemand.com</span>
</p>
</div>
</td>
</tr>
</tbody>
</table>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:10px 10px 33px;font-family:'Cabin',sans-serif;"
align="left">
<div align="center">
<div style="display: table; max-
width:146px;">
<!--[if (mso)|(IE)]><table width="146"
cellpadding="0" cellspacing="0" border="0"><tr><td style="border-
collapse:collapse;" align="center"><table width="100%" cellpadding="0"
cellspacing="0" border="0" style="border-collapse:collapse; mso-table-lspace:
0pt;mso-table-rspace: 0pt; width:146px;"><tr><![endif]-->
src="https://cdn.tools.unlayer.com/social/icons/circle-black/facebook.png"
alt="Facebook"
title="Facebook" width="32"
style="outline: none;text-
decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !
important;border: none;height: auto;float: none;max-width: 32px !important">
</a>
</td>
</tr>
</tbody>
</table>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]><td width="32"
style="width:32px; padding-right: 17px;" valign="top"><![endif]-->
<table align="left" border="0"
cellspacing="0" cellpadding="0" width="32" height="32"
style="width: 32px !
important;height: 32px !important;display: inline-block;border-collapse:
collapse;table-layout: fixed;border-spacing: 0;vertical-align: top;margin-right:
17px">
<tbody>
<tr style="vertical-align: top">
<td align="left"
valign="middle"
style="word-break: break-
word;border-collapse: collapse !important;vertical-align: top">
<a href="https://linkedin.com/"
title="LinkedIn" target="_blank">
<img
src="https://cdn.tools.unlayer.com/social/icons/circle-black/linkedin.png"
alt="LinkedIn"
title="LinkedIn" width="32"
style="outline: none;text-
decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !
important;border: none;height: auto;float: none;max-width: 32px !important">
</a>
</td>
</tr>
</tbody>
</table>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if
(mso)|(IE)]></tr></table></td></tr></table><![endif]-->
</div>
</div>
</td>
</tr>
</tbody>
</table>
<!--[if (!mso)&(!IE)]><!-->
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><!
[endif]-->
</div>
</div>
</div>
<table style="font-family:'Cabin',sans-serif;"
role="presentation" cellpadding="0" cellspacing="0"
width="100%" border="0">
<tbody>
<tr>
<td
style="overflow-wrap:break-word;word-
break:break-word;padding:10px;font-family:'Cabin',sans-serif;"
align="left">
<div
style="font-size: 14px; color: #fafafa;
line-height: 180%; text-align: center; word-wrap: break-word;">
<p style="font-size: 14px; line-height:
180%;"><span
style="font-size: 16px; line-
height: 28.8px;">Copyrights © STANDARD ALLEMAND SARL .All Rights
Reserved</span></p>
</div>
</td>
</tr>
</tbody>
</table>
<!--[if (!mso)&(!IE)]><!-->
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td><![endif]-->
<!--[if (mso)|(IE)]></tr></table></td></tr></table><!
[endif]-->
</div>
</div>
</div>
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
<!--[if mso]></div><![endif]-->
<!--[if IE]></div><![endif]-->
</body>
</html>
""".format(image_tag, namePartner, name_email, code)