mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Also sanitize email address used for testing
This commit is contained in:
parent
da339e639d
commit
e14f96454f
@ -67,12 +67,17 @@ class TestEmail(QDialog):
|
|||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
try:
|
from email.utils import parseaddr
|
||||||
tb = self.test_func(str(self.to.text())) or _('Email successfully sent')
|
addr = parseaddr(self.to.text().strip())[-1]
|
||||||
except Exception:
|
if not addr:
|
||||||
import traceback
|
tb = f'{self.to.text().strip()} is not a valid email address'
|
||||||
tb = traceback.format_exc()
|
else:
|
||||||
self.test_done.emit(tb)
|
try:
|
||||||
|
tb = self.test_func(addr) or _('Email successfully sent')
|
||||||
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
tb = traceback.format_exc()
|
||||||
|
self.test_done.emit(tb)
|
||||||
|
|
||||||
def on_test_done(self, txt):
|
def on_test_done(self, txt):
|
||||||
if self.isVisible():
|
if self.isVisible():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user