Send email with Follow up flag and reminder datetime in Python

607 Views Asked by At

I am trying to send email using Python script and MIMEMultipart object.

The sending of email is working just fine, but I am trying to flag the email Follow Up with a bell Reminder time. Currently [Reply-By] is not creating a reminder for recipient.

This action would be the same as when user add follow up flag and check the reminder at Outlook and there will be a alarm bell icon when recipient view the email.

My current code:

#Email settings for Sender(From), Recipient (To), CC, Subject and High Priority level
msg = MIMEMultipart()
msg['From'] = email_user
msg['To'] = ", ".join(email_recipients)
msg['Cc'] = ", ".join(cc_recipients)
msg['Subject'] = '''UPDATE OF PAYMENT SCHEDULE FOR ''' + next_month_name.upper() + ''' ''' + next_month_year
msg['X-Priority'] = '2'
msg['X-Message-Flag'] = 'Follow up'
msg['Reply-By'] = '16/06/2022 09:00:00'

msg.attach(MIMEText(email_body, 'html'))

#Code to send email
server = smtplib.SMTP('smtp.office365.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(email_user, email_pass) 
server.send_message(msg)
server.quit()
0

There are 0 best solutions below