From f9e0afffe22c63569d7849e1f63590f330f90f62 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Sep 2016 21:00:37 +0530 Subject: [PATCH] Add a tweak to Preferences->Tweaks to control the list of servers calibre considers public email servers --- resources/default_tweaks.py | 5 ++++- src/calibre/gui2/email.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index cc73dcbd7f..dad8fea0c2 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -437,8 +437,11 @@ metadata_edit_custom_column_order = [] # public email server like gmx/hotmail/gmail. Default is: 5 minutes # Setting it to lower may cause the server's SPAM controls to kick in, # making email sending fail. Changes will take effect only after a restart of -# calibre. +# calibre. You can also change the list of hosts that calibre considers +# to be public relays here. Any relay host ending with one of the suffixes +# in the list below will be considered a public email server. public_smtp_relay_delay = 301 +public_smtp_relay_host_suffixes = ['gmail.com', 'live.com', 'gmx.com'] #: The maximum width and height for covers saved in the calibre library # All covers in the calibre library will be resized, preserving aspect ratio, diff --git a/src/calibre/gui2/email.py b/src/calibre/gui2/email.py index d0ef891e9b..cc9e9fd91a 100644 --- a/src/calibre/gui2/email.py +++ b/src/calibre/gui2/email.py @@ -62,9 +62,11 @@ class Sendmail(object): self.rate_limit = 1 opts = email_config().parse() rh = opts.relay_host - if rh and ( - 'gmail.com' in rh or 'live.com' in rh or 'gmx.com' in rh): - self.rate_limit = tweaks['public_smtp_relay_delay'] + if rh: + for suffix in tweaks['public_smtp_relay_host_suffixes']: + if rh.lower().endswith(suffix): + self.rate_limit = tweaks['public_smtp_relay_delay'] + break def __call__(self, attachment, aname, to, subject, text, log=None, abort=None, notifications=None):