Search code examples
pythongmailsmtplibforwarding

Configure (gmail) email in python to prevent users from forwarding an email


I am using smtplib to send automatic emails (with Gmail) to a list of users. I want to prevent them from forwarding the emails they receive.

To my knowledge, there is no default setting on Gmail that makes all the emails sent from a given account not forwardable. There is a confidential mode, which however must be set up for every new email and would prevent forwarding (and printing, downloading, etc...) for up to 5 years.

My question is: in the absence of a default setting on gmail that makes all emails not forwardable, can you suggest some python code that automatically selects the confidential mode for every email that is sent?

enter image description here enter image description here


Solution

  • Doing something this specific will require the Google-provided Gmail API, as that's not a standard feature of SMTP. Try looking here, Google's developer QuickStart for Gmail.