add the possibility to send email

This commit is contained in:
2022-12-10 01:27:11 +01:00
parent bdb250f03b
commit f11e4c58a5
2 changed files with 204 additions and 0 deletions
+164
View File
@@ -0,0 +1,164 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style type="text/css">/* reset */
#outlook a {
padding: 0;
}
/* Force Outlook to provide a "view in browser" menu link. */
.ExternalClass {
width: 100%;
}
/* Force Hotmail to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
line-height: 100%;
}
/* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
p {
margin: 0;
padding: 0;
font-size: 0px;
line-height: 0px;
}
/* squash Exact Target injected paragraphs */
table td {
border-collapse: collapse;
}
/* Outlook 07, 10 padding issue fix */
table {
border-collapse: collapse;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
/* remove spacing around Outlook 07, 10 tables *//* bring inline */
img {
display: block;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
a {
text-decoration: none;
color: #3a3aff;
}
/* text link */
a.phone {
text-decoration: none;
color: #3a3aff !important;
pointer-events: auto;
cursor: default;
}
/* phone link, use as wrapper on phone numbers */
span {
font-size: 14px;
line-height: 20px;
font-family: monospace;
color: #000001;
}
table td {
font-size: 14px;
line-height: 20px;
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
color: #666;
text-align: justify;
}</style>
<!--[if gte mso 9]>
<style>/* Target Outlook 2007 and 2010 */</style><![endif]--></head>
<body style="width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;">
<!-- body wrapper -->
<table cellpadding="0" cellspacing="0" border="0"
style="margin:0; padding:0; width:100%; line-height: 100% !important;">
<tr>
<td valign="top"><!-- edge wrapper -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600">
<tr>
<td valign="top"><!-- content wrapper -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="560">
<tr>
<td valign="top" style="vertical-align: top;">
<table style="width: 100%;" cellpadding="0" cellspacing="0" border="0"
align="center">
<tr>
<td valign="top"
style="vertical-align: top; padding: 10px; text-align: center;"><img
src="https://rendezvousparis.hermes.com/img/hermes-logo.png"
style="display: inline; width: 90px; height: 55px;"/></td>
</tr>
<tr>
<td valign="top"
style="vertical-align: top; padding: 10px; background-image: url('https://rendezvousparis.hermes.com/img/separator.png'); background-size: 20px 17px; background-repeat: repeat-x;"></td>
</tr>
<tr>
<td valign="top" style="vertical-align: top; padding: 10px;">
<table style="width: 100%;" cellpadding="0" cellspacing="0" border="0"
align="center">
<tr>
<td valign="top" style="padding-top: 15px;">Dear Madam / Dear
Sir,
</td>
</tr>
<tr>
<td valign="top" style="padding-top: 15px;">We are pleased to
confirm your appointment.
</td>
</tr>
<tr>
<td valign="top" style="padding-top: 15px;">You will be welcomed
on Dec 10, 2022 in our store at 42 avenue George V at 5:25
PM.
</td>
</tr>
<tr>
<td valign="top" style="padding-top: 15px;">The given hour might
be subject to change. Please kindly follow up on your
appointment status on <a href="https://rendezvousparis.hermes.com/client/XARMBP">https://rendezvousparis.hermes.com/client/XARMBP</a>
</td>
</tr>
<tr>
<td valign="top" style="padding-top: 15px;">As your appointment
approaches, we invite you to introduce yourself to one of
our receptionists.
</td>
</tr>
<tr>
<td valign="top" style="padding-top: 15px;">Please bring the
proof of identity used on our website.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top"
style="vertical-align: top; padding: 10px; text-align: center; min-height: 100px;">
<img src="https://rendezvousparis.hermes.com/img/hline-gif.gif"
style="display: inline; width: 100%;"/></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
+40
View File
@@ -0,0 +1,40 @@
"""
Run:
"""
from mailjet_rest import Client
from src import config
api_key = "489274f04d5c155f81370fccc3904e20"
api_secret = "edac41f0e1726ba49808dfb12204ecd6"
mailjet = Client(auth=(api_key, api_secret), version='v3.1')
from_email = "panleicim@gmail.com"
# store = "Hermès Paris Faubourg"
store = "Hermès Paris George V"
dest_email = "panleicim@gmail.com"
contact_name = "LUO Meiling"
f = open(config.ROOT_DIR + "/templates/confirmed_rdv.html", "r")
email_body = f.read()
print(email_body)
data = {
'Messages': [
{
"From": {
"Email": from_email,
"Name": store
},
"To": [
{
"Email": dest_email,
"Name": contact_name
}
],
"Subject": "Your appointment is confirmed!",
"HTMLPart": email_body
}
]
}
result = mailjet.send.create(data=data)
print(result.status_code)
print(result.json())