Mobileread
Autosend MOBI file via email to Kindle after conversion
#1  ConsumatePro 01-15-2019, 03:37 AM
I know calibre can auto-send news via email to the Kindle.

I'm trying to find a function that will auto-send email to Kindle after conversion of a file (eg. epub). I'd love to see a function that "automatically send converted books to email" similar to the function in the "Behaviour" panel.

Is this possible?
Reply 

#2  kovidgoyal 01-15-2019, 07:12 AM
Just select the book(s) and send by email, if they are not already in kindle format they will be auto-converted and sent
Reply 

#3  ConsumatePro 01-15-2019, 08:23 PM
Thanks, Kovid (BTW thanks for an amazing app!).

Actually, that's how I'm doing it currently - manually selecting each epub then clicking the "Connect/Share" button to email, which then converts to MOBI then emails it.

I'm looking for an even lazier way to do this:
1. Monitor a folder for new epub books
2. Automatically import into Calibre, convert to MOBI
3. Email to Kindle email address

I know steps 1&2 are already built into Calibre, but right now, auto-import would import books and convert them to MOBI, but then I can't tell what's been sent via email.

In my current workflow, I'm staying with manual import, then click "Connect/share" to email. This way, I know if I don't see a MOBI format, then I know the epub hasn't yet been sent to Kindle.

I'm hoping therefore for just one more automatic step in the "Automatic adding" feature aside from "Automatically convert added files to the current output format" but another checkbox to "Automatically email ebook (using the options configured in "Sharing books by email")"

Another way to do this, perhaps: In the "Sharing books by email" panel, the "Auto send" option I believe only works with news feeds, but another way to implement this would be to "autosend new books".

I hope that's clear enough. I know I'm being supremely lazy but Calibre offers so much functionality, I'm spoiled! Thanks again for your work.
Reply 

#4  kovidgoyal 01-15-2019, 09:59 PM
You can select multiple books and send in one go, no need to do it one at a time.

I dont think I want to add an auto email for any newly imported book, there are too many ways books can be imported and sending emails is a fairly large side-effect, sorry.
Reply 

#5  ConsumatePro 01-16-2019, 12:49 AM
Definitely understand - thanks for considering anyhow!
Reply 

#6  nik_0_0 03-29-2020, 08:50 PM
Bumping this - this is exactly the feature I was curious about. The "send to email" function works perfectly and the "automatically watch folder" works perfectly, and the "automatically convert to mobi" works perfectly too.

If there could be a connection between step 2 (auto convert to mobi) and step 3 (send to email) - as ConsumatePro mentions, the entire process from ingestion to device would be completely hands off. It would be beautiful!

The default 5 minute timeout on emails would hopefully protect against any large import. (It would generate a large, slowly draining queue, which would be awesome!)

Personally I only do small imports of one or two documents at a time, but having it be completely hands off would be so great.

Completely understand your reasoning Kovid.

--

This was fairly easy to hack into Calibre. What a beautifully designed application. And great getting started documentation.

I subverted convert.py::auto_convert_auto_add which is called for all auto_add files, and forced it to call book_auto_converted_mail instead of book_converted.

I had to grab email_config(), and currently have it hardcoded to expect there to be a default email setup.

Will try and clean it up a little so it doesn't barf if there is no default email, and gracefully falls back. Attaching patch file in case anyone is interested.
[txt] hack_in_auto_email.txt (2.0 KB, 25 views)
Reply 

#7  jt3 05-11-2020, 03:26 PM
Quote nik_0_0
Bumping this - this is exactly the feature I was curious about. The "send to email" function works perfectly and the "automatically watch folder" works perfectly, and the "automatically convert to mobi" works perfectly too.

If there could be a connection between step 2 (auto convert to mobi) and step 3 (send to email) - as ConsumatePro mentions, the entire process from ingestion to device would be completely hands off. It would be beautiful!

The default 5 minute timeout on emails would hopefully protect against any large import. (It would generate a large, slowly draining queue, which would be awesome!)

Personally I only do small imports of one or two documents at a time, but having it be completely hands off would be so great.

Completely understand your reasoning Kovid.

--

This was fairly easy to hack into Calibre. What a beautifully designed application. And great getting started documentation.

I subverted convert.py::auto_convert_auto_add which is called for all auto_add files, and forced it to call book_auto_converted_mail instead of book_converted.

I had to grab email_config(), and currently have it hardcoded to expect there to be a default email setup.

Will try and clean it up a little so it doesn't barf if there is no default email, and gracefully falls back. Attaching patch file in case anyone is interested.
Nik, do you mind giving me a run through of how you implemented the patch? I'm new to the software but would really love to be able to implement this.
Reply 

#8  nik_0_0 05-19-2020, 04:45 AM
Yeah - certainly JT3. I am new to Calibre as well, and the only reason I was able to get as far as I did is the awesome 'getting started' page here:
https://manual.calibre-ebook.com/develop.html#getting-the-code

I happened to be on my Windows computer, so I followed the steps in the "Windows development environment", and was up and running in just a minute or two (I mistyped the environment variable the first time and it threw a nice, verbose error.)

Since Kovid has included the ability to allow a normal install of Calibre to use the source directory directly, I didn't even need to worry about compiling or python version or anything. It just worked. (starting with hello world example!)

Assuming you aren't asking about implementation details - (which was just basically digging around all the Python functions in the code with the string "email") - that was all it took. If you want to apply the patch to your own installation, follow those same instructions in the link, but then take that hack_in_auto_email.txt file, and apply it to that directory using 'git apply' (https://git-scm.com/docs/git-apply).

I would love to get this pushed to the github, so will try to circle back to it in a while. Hope this helped!
Reply 

Today's Posts | Search this Thread | Login | Register