Search code examples
pythonemailoutlookpywin32

Require receipts when sending Outlook email by Python


Simple lines to send Outlook email by Python,

referencing from Send email through Python using Outlook 2016 without opening it

import win32com.client as win32

outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = '[email protected]'
mail.Subject = 'Message subject'
mail.Body = 'Message body'

mail.Send()

Is it possible to require Delivery Receipt and Read Receipt when sending an email? What would be the good way?

enter image description here


Solution

  • Sure, use ReadReceiptRequested & OriginatorDeliveryReportRequested property MSDN

    Example

    import win32com.client as win32
    
    outlook = win32.Dispatch('outlook.application')
    mail = outlook.CreateItem(0)
    mail.To = "[email protected]"
    mail.Subject = 'Message subject'
    mail.Body = 'Message body'
    # request read receipt
    mail.ReadReceiptRequested = True
    # request delivery receipt
    mail.OriginatorDeliveryReportRequested = True
    mail.Send()