mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Allow empty username and password for SMTP server
This commit is contained in:
parent
f2d9d40146
commit
af9d22fa52
@ -92,7 +92,8 @@ class SendEmail(QWidget, Ui_Form):
|
|||||||
pa = self.preferred_to_address()
|
pa = self.preferred_to_address()
|
||||||
to_set = pa is not None
|
to_set = pa is not None
|
||||||
if self.set_email_settings(to_set):
|
if self.set_email_settings(to_set):
|
||||||
if question_dialog(self, _('OK to proceed?'),
|
opts = smtp_prefs().parse()
|
||||||
|
if not opts.relay_password or question_dialog(self, _('OK to proceed?'),
|
||||||
_('This will display your email password on the screen'
|
_('This will display your email password on the screen'
|
||||||
'. Is it OK to proceed?'), show_copy_button=False):
|
'. Is it OK to proceed?'), show_copy_button=False):
|
||||||
TestEmail(pa, self).exec_()
|
TestEmail(pa, self).exec_()
|
||||||
@ -204,11 +205,19 @@ class SendEmail(QWidget, Ui_Form):
|
|||||||
username = unicode(self.relay_username.text()).strip()
|
username = unicode(self.relay_username.text()).strip()
|
||||||
password = unicode(self.relay_password.text()).strip()
|
password = unicode(self.relay_password.text()).strip()
|
||||||
host = unicode(self.relay_host.text()).strip()
|
host = unicode(self.relay_host.text()).strip()
|
||||||
if host and not (username and password):
|
if host and ((username and not password) or (not username and password)):
|
||||||
error_dialog(self, _('Bad configuration'),
|
error_dialog(self, _('Bad configuration'),
|
||||||
_('You must set the username and password for '
|
_('You must either set the username and password for '
|
||||||
'the mail server.')).exec_()
|
'the mail server or no username and no password at all.')).exec_()
|
||||||
return False
|
return False
|
||||||
|
elif host and not (username and password) and self.relay_ssl.isChecked():
|
||||||
|
error_dialog(self, _('Bad configuration'),
|
||||||
|
_('Please enter username and password for SSL encryption. ')).exec_()
|
||||||
|
return False
|
||||||
|
elif host and not (username and password) and not question_dialog(self,
|
||||||
|
_('Are you sure?'),
|
||||||
|
_('No username and password set for mailserver. Continue anyways?')):
|
||||||
|
return False
|
||||||
conf = smtp_prefs()
|
conf = smtp_prefs()
|
||||||
conf.set('from_', from_)
|
conf.set('from_', from_)
|
||||||
conf.set('relay_host', host if host else None)
|
conf.set('relay_host', host if host else None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user