deletes email after download
This commit is contained in:
parent
28fe200923
commit
ecbdaaa5f6
@ -1,4 +1,3 @@
|
||||
|
||||
import os
|
||||
import base64
|
||||
import requests
|
||||
@ -91,6 +90,10 @@ def process_email(service, message):
|
||||
if link:
|
||||
pdf_link = link.get("href")
|
||||
download_pdf(pdf_link)
|
||||
|
||||
# After successful download, delete the email
|
||||
service.users().messages().delete(userId='me', id=message['id']).execute()
|
||||
logging.info(f"Email with ID {message['id']} successfully deleted after PDF download.")
|
||||
else:
|
||||
logging.info("No 'PDF herunterladen' link found in this email.")
|
||||
except Exception as error:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user