Add a tweak to Preferences->Tweaks to control the list of servers calibre considers public email servers

This commit is contained in:
Kovid Goyal 2016-09-15 21:00:37 +05:30
parent 0a90e37ad7
commit f9e0afffe2
2 changed files with 9 additions and 4 deletions

View File

@ -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,

View File

@ -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):
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):