mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1989282 [Cannot email to Kindle after release 5.29](https://bugs.launchpad.net/calibre/+bug/1989282)
At least I hope. Who knows what amazon's stupid email service barfs on.
This commit is contained in:
parent
dfdb79a3ae
commit
0add257e90
@ -153,16 +153,20 @@ def send_mails(jobnames, callback, attachments, to_s, subjects,
|
|||||||
for name, attachment, to, subject, text, aname in zip(jobnames,
|
for name, attachment, to, subject, text, aname in zip(jobnames,
|
||||||
attachments, to_s, subjects, texts, attachment_names):
|
attachments, to_s, subjects, texts, attachment_names):
|
||||||
description = _('Email %(name)s to %(to)s') % dict(name=name, to=to)
|
description = _('Email %(name)s to %(to)s') % dict(name=name, to=to)
|
||||||
if isinstance(to, str):
|
if isinstance(to, str) and ('@kindle.com' in to or '@pbsync.com' in to):
|
||||||
if '@kindle.com' in to:
|
# The PocketBook service is a total joke. It cant handle
|
||||||
aname = ascii_filename(aname)
|
# non-ascii, filenames that are long enough to be split up, commas, and
|
||||||
elif '@pbsync.com' in to:
|
# the good lord alone knows what else. So use a random filename
|
||||||
# The PocketBook service is a total joke. It cant handle
|
# containing only 22 English letters and numbers
|
||||||
# non-ascii, filenames that are long enough to be split up, commas, and
|
#
|
||||||
# the good lord alone knows what else. So use a random filename
|
# And since this email is only going to be processed by automated
|
||||||
# containing only 22 English letters and numbers
|
# services, make the subject random too as at least the amazon
|
||||||
from calibre.utils.short_uuid import uuid4
|
# service cant handle non-ascii subjects. I dont know what baboons
|
||||||
aname = f'{uuid4()}.' + aname.rpartition('.')[-1]
|
# these companies employ to write their code. It's the height of
|
||||||
|
# irony that they are called "tech" companies.
|
||||||
|
from calibre.utils.short_uuid import uuid4
|
||||||
|
aname = f'{uuid4()}.' + aname.rpartition('.')[-1]
|
||||||
|
subject = uuid4()
|
||||||
job = ThreadedJob('email', description, gui_sendmail, (attachment, aname, to,
|
job = ThreadedJob('email', description, gui_sendmail, (attachment, aname, to,
|
||||||
subject, text), {}, callback)
|
subject, text), {}, callback)
|
||||||
job_manager.run_threaded_job(job)
|
job_manager.run_threaded_job(job)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user