Search code examples
emailflaskflask-mail

Flask-Mail - Any way to request Read Receipt?


I just spent a little time browsing similar questions on here, and it looks like some mail frameworks have a way of sending the proper signals to a mail client for the confirmation of read receipts.

The project on which I am working must have Read-Receipts requested as all the recipients have auto-sent read receipts enabled, and also have images blocked so I'm unable to use image-loading for tracking.

I'm most familiar with Python, Flask, and Flask-Mail, which is why I'm starting here to see if anyone knows a way to request this through these frameworks, or perhaps knows what to add to a to a mail header to request this.

Thanks!


Solution

  • So after a little more research and testing, in the absence of a specific setting in Flask-Mail for read-receipts, it is possible to request them by defining the header Disposition-Notification-To using extra_headers in the Flask-Mail Message() definition in order to trigger a read-receipt request:

    sender = '[email protected]'
    recipient = '[email protected]'
    
    msg = Message(subject='Testing Read Receipt',
                  recipients=[recipient],
                  sender = ('Testy McTesterson', sender),
                  extra_headers={'Disposition-Notification-To': sender})