Skip to content

About

A script made to periodically connect to a given mailbox using IMAP and print out whatever arrives as a PDF.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

mailprinter

Script which connects to an IMAP mailbox and prints whatever arrives as PDF using a given CUPS printer.

How to use:

  1. Set your parameters in config.ini.
  2. Launch in the background, via screen, or define a systemd service.

IMAP parameters

  • keyword: A word that must be included in the subject for the script to process the email, preventing spam mails from being printed. AuThEnTICAtiOn yay
  • delete_mail: Whether the script should delete all emails in the mailbox after processing.

Printer setup

If using a remote host, ensure that CUPS accepts remote print jobs:

cupsctl --share-printers

This command allows printing on the local subnet. If it's on a remote subnet, use:

cupsctl --share-printers --remote-any

Then, set a particular printer to shared. Check the printer names:

root@jelito ~ $ lpstat
Xerox_WorkCentre_3025-34 root              1024   Sun 07 Jan 2024 01:31:51 PM CET
Basement_Brother_Printer       root                 0   Fri 03 Jan 2025 12:50:11 PM CET

Set a particular printer to shared:

lpadmin -p Basement_Brother_Printer -o printer-is-shared=true

Use this CUPS printer name in the printer section of the config.ini.

The following will just list out printers on a given host, mailboxes in a given IMAP server and quit.

python3 mailprinter.py list

About

A script made to periodically connect to a given mailbox using IMAP and print out whatever arrives as a PDF.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages