Sample Header Ad - 728x90

Batch extract pdf from emails on Debian in bash

0 votes
0 answers
202 views
**What I'm trying to achieve:** I am trying to send pdf documents to my Remarkable 2 tablet via email. **How I'm trying to do it:** 1. I set up rmfakecloud: a software that runs on your server and emulates the official Remarkable cloud system, so you're in control of your data 2. I set up rmapi: a software that allows to interact with rmfakecloud and official Remarkable 2 cloud through the command line 3. I set up an email account on gmail tablet@mydomain.com enabling login with less secure apps (i.e.: allow to login without second authentication factor) 4. I wrote (with the help of ChatGPT, I must admit) a short bash script that: * Downloads all emails from said account * Checks if the sender matches my email account (myself@mydomain.com) * Extracts the files from the email, if they are pdf ** Maildir Folder [Gmail]/Drafts [acc: Gmail]: Syncing [Gmail]/Drafts: Gmail -> Maildir Folder [Gmail]/Important [acc: Gmail]: Syncing [Gmail]/Important: Gmail -> Maildir Folder [Gmail]/Sent Mail [acc: Gmail]: Syncing [Gmail]/Sent Mail: Gmail -> Maildir Folder [Gmail]/Spam [acc: Gmail]: Syncing [Gmail]/Spam: Gmail -> Maildir Folder [Gmail]/Starred [acc: Gmail]: Syncing [Gmail]/Starred: Gmail -> Maildir Folder [Gmail]/Trash [acc: Gmail]: Syncing [Gmail]/Trash: Gmail -> Maildir Folder INBOX [acc: Gmail]: Syncing INBOX: Gmail -> Maildir Account sync Gmail: *** Finished account 'Gmail' in 0:01 **What I understood is going wrong:** From my understanding, the script manages to download mail from gmail imap server, and manages to upload files to the cloud server if files are provided. *What doesn't work*, is the extraction of pdf files from the emails. I really don't know what is going wrong, and I don't know what could be an easier approach. **How I plan to run the script:** I plan to demonize the script and run it as a systemd service
Asked by giovi321 (919 rep)
Apr 6, 2023, 09:21 PM
Last activity: Apr 7, 2023, 09:48 PM