This script connects to a Gmail account via IMAP, searches for emails containing unsubscribe links, and extracts those links. It uses multithreading to speed up the process.
- Connects to Gmail using IMAP
- Searches for emails containing the word "unsubscribe"
- Extracts unsubscribe links from the email body and headers
- Uses multithreading for faster processing
- Python 3.x
- A Gmail account with IMAP enabled
Install the required Python packages using pip:
pip install -r requirements.txtOR
pip3 install -r requirements.txt-
Set up your credentials file:
Create a
credentials.yamlfile in the same directory as the script. Add your Gmail username and password (or app password) to the file:user: your_email@gmail.com password: your_password OR your_app_password
-
Run the script:
Execute the script from the command line:
python script_name.py
OR
python3 script_name.py
The script will connect to Gmail, search for emails with unsubscribe links, and save the links to
unsubscribe_links.txt.
Ensure your credentials.yaml file is correctly formatted with your Gmail credentials. The script will use this file to log in to your Gmail account.
The script connects to imap.gmail.com by default. Ensure IMAP access is enabled in your Gmail settings.
Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.
This project is licensed under the MIT License. See the LICENSE file for details.