SMTP - server_hostname cannot be an empty string or start with a leading dot.
See original GitHub issueHello Community,
I have a problem with the smtp notification settings.
Command: icloudpd --username=nico***@googlemail.com --password=*** --directory=/mnt/data/private/Bilder/2099-12-31\ iCloud/ --size=original --live-photo-size=original --auto-delete --folder-structure={:\%Y/\%m-\%B} --smtp-username blablabla@gmx.de --smtp-password o9*** --smtp-host mail.gmx.net --smtp-port 587 --notification-email nico***@gmail.com
Error:
Keyring config file contains incorrect values.
Config file: /root/.local/share/python_keyring/keyringrc.cfg
2020-11-10 21:30:35 DEBUG Authenticating...
2020-11-10 21:30:37 INFO Sending 'two-step expired' notification via email...
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/icloudpd/base.py", line 260, in main
client_id=os.environ.get("CLIENT_ID"),
File "/usr/local/lib/python3.7/dist-packages/icloudpd/authentication.py", line 44, in authenticate
"Two-step/two-factor authentication is required!"
icloudpd.authentication.TwoStepAuthRequiredError: Two-step/two-factor authentication is required!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/icloudpd", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/icloudpd/base.py", line 272, in main
notification_email,
File "/usr/local/lib/python3.7/dist-packages/icloudpd/email_notifications.py", line 22, in send_2sa_notification
smtp.starttls()
File "/usr/lib/python3.7/smtplib.py", line 771, in starttls
server_hostname=self._host)
File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/usr/lib/python3.7/ssl.py", line 846, in _create
owner=self, session=self._session,
ValueError: server_hostname cannot be an empty string or start with a leading dot.
But why? Can someone help me?
icloudpd --version
icloudpd, version 1.7.0
Installed over pip install icloudpd
Without the smtp options, works and downloading my photos, after two-factor authentication.
I cannot currently reproduce the problem because the two-factor authentication was successful. It will not occur again until two factor authentication is required again.
Cheers Nico
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
The error “server_hostname cannot be an empty string or start with a leading dot” seems to relate to a python bug with smtplib - https://bugs.python.org/issue36094
I was able to fix it by changing SMTP client session object creation in email_notifications.py from
smtp = smtplib.SMTP()
to
smtp = smtplib.SMTP(smtp_host, smtp_port)
Works! You can merge the PR. 👍