I am currently trying to write a function which will create a mail and then displayed it through Outlook. Like this the user will be able to create and see his new mail under Outlook, and just decide to click on Send or not.
I struggle to find an attribute to smtplib, or an attribute to Mimemultipart like smtplib.display() or
msg = MIMEMultipart('alternative')
msg = email.message.Message()
msg.display(True).
I already succesfully create and send automatically mail with smtplib. What I can't find on the web, is this attribute to display the crated mail.....
What I have:
def createEmailConfirmation():
email_content = """\
<!DOCTYPE html><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div class="table-responsive">
<table class="table table-bordered m-b-0">
<thead>
<tr>
<th> Title </th>
</tr>
</thead>
<tbody>
<tr>
<td> Confirmation </td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
"""
msg = MIMEMultipart('alternative')
msg = email.message.Message()
msg['Subject'] = 'Confirmation Mail'
toaddr = ['useraddressmail@test.com']
bcc = ['']
cc = ['']
fromaddr = ''other_useraddressmail@test.com'
toaddrs = toaddr + cc + bcc
password = "password"
msg.add_header('Content-Type', 'text/html')
msg.set_payload(email_content)
s = smtplib.SMTP('**.***.**.**')
s.set_debuglevel(False) # show communication with the server
msg.display
I think it something really easy, that will only fit In one line but I can't find it...
Best Regards,