This Python script allows you to automatically download PDF attachments from Outlook emails. It works with multiple email accounts and saves the downloaded PDF files to a specified folder on your local hard drive.
- Python 3.x installed on your system.
- Required Python libraries:
win32com
,os
You can install the required libraries using pip:
pip install pywin32
-
Clone this repository or download the
outlook_pdf_attachment_downloader.py
script to your local machine. -
Open the
outlook_pdf_attachment_downloader.py
file in a text editor. -
Modify the
download_folder
variable to specify the folder where you want to save the downloaded PDF attachments. For example:download_folder = r"C:\Users\YourUsername\Documents\Attachments"
Replace
YourUsername
with your actual username. -
If you have multiple email accounts in Outlook and want to download PDF attachments from all of them, update the
account_numbers
list to include the correct account indices. To find the correct account indices, run the script withaccount_numbers = [0]
, and observe the output. Then update the list with the correct account indices:account_numbers = [0, 1, 2] # Update with the correct account indices
-
Make sure Outlook is open and logged in to your email accounts.
-
Open a terminal or command prompt.
-
Navigate to the directory containing the
outlook_pdf_attachment_downloader.py
file. -
Run the script using the following command:
python outlook_pdf_attachment_downloader.py
The script will start processing emails from the specified accounts' Inboxes, and any PDF attachments found will be downloaded to the specified
download_folder
.
-
This script works with the Windows version of Outlook.
-
Use this script responsibly and only on your own Outlook accounts or with proper authorization from the account owners.
This project is licensed under the MIT License - see the LICENSE file for details.