mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When sending emails to amazon and pocketbook use random english text instead of UUIDs for subject/body
Might workaround amazons latest attempt at blocking emails from calibre. See #2110400 (Amazon blocking calibre mails sendtokindle)
This commit is contained in:
parent
e1bf592824
commit
43912e02bc
@ -170,8 +170,13 @@ def send_mails(jobnames, callback, attachments, to_s, subjects,
|
|||||||
# file internal metadata so don't nuke the filename.
|
# file internal metadata so don't nuke the filename.
|
||||||
# https://www.mobileread.com/forums/showthread.php?t=349290
|
# https://www.mobileread.com/forums/showthread.php?t=349290
|
||||||
aname = f'{uuid4()}.' + aname.rpartition('.')[-1]
|
aname = f'{uuid4()}.' + aname.rpartition('.')[-1]
|
||||||
subject = uuid4()
|
import random
|
||||||
text = uuid4()
|
|
||||||
|
from calibre.utils.random_ua import common_english_words, random_english_text
|
||||||
|
words = common_english_words()
|
||||||
|
num_in_subject = random.randrange(3, 9)
|
||||||
|
subject = ' '.join(random.choice(words) for i in range(num_in_subject))
|
||||||
|
text = random_english_text()
|
||||||
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)
|
||||||
|
@ -23,6 +23,17 @@ def common_english_words():
|
|||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
def random_english_text():
|
||||||
|
import random
|
||||||
|
num_sentences = random.randrange(1, 4)
|
||||||
|
words = common_english_words()
|
||||||
|
|
||||||
|
def sentence():
|
||||||
|
num_words = random.randrange(23, 42)
|
||||||
|
return ' '.join(random.choice(words) for i in range(num_words)).capitalize() + '.'
|
||||||
|
return ' '.join(sentence() for i in range(num_sentences))
|
||||||
|
|
||||||
|
|
||||||
def common_user_agents():
|
def common_user_agents():
|
||||||
return user_agent_data()['common_user_agents']
|
return user_agent_data()['common_user_agents']
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user