Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting up mail in --init step #1

Open
nevillator-999 opened this issue Jun 3, 2020 · 10 comments
Open

setting up mail in --init step #1

nevillator-999 opened this issue Jun 3, 2020 · 10 comments

Comments

@nevillator-999
Copy link

I am having trouble getting this setup to use an SMTP server to send alerts.

This is the output after entering account, password, port, etc. I have tried an Apple mail (me.com) with app-password (2FA is set up on the account), as well as local ISP mail account without 2FA setup. This ends back at a prompt and does not go further.

Traceback (most recent call last):
File "/home/pi/python/ven/bin/outage_detector", line 10, in
sys.exit(main())
File "/home/pi/python/ven/lib/python3.7/site-packages/outagedetector/main.py", line 18, in main
config.initialize()
File "/home/pi/python/ven/lib/python3.7/site-packages/outagedetector/initial_config.py", line 71, in initialize
"Mail sent successfully!", json_data["smtp_server"], password, json_data["port"])
File "/home/pi/python/ven/lib/python3.7/site-packages/outagedetector/send_mail.py", line 40, in send_mail
with SMTP_SSL(smtp_server, port, context=context) as server:
File "/usr/lib/python3.7/smtplib.py", line 1031, in init
source_address)
File "/usr/lib/python3.7/smtplib.py", line 251, in init
(code, msg) = self.connect(host, port)
File "/usr/lib/python3.7/smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python3.7/smtplib.py", line 1039, in _get_socket
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 853, in _create
self.do_handshake()
File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)

@fabytm
Copy link
Owner

fabytm commented Jun 3, 2020

I will have to test this out.

Have you tried using Gmail, for example? I've gotten issues with mail before, but mostly because of 2FA or having the "Block unauthorised apps" security feature turned on.

@nevillator-999
Copy link
Author

I have not. I will create a gmail account and test it that way as well.

@jaaabeee
Copy link

jaaabeee commented Jun 4, 2020

Am having the same issue as OP. Same email server (iCloud) and same traceback. Will try with Gmail next...

@jaaabeee
Copy link

jaaabeee commented Jun 4, 2020

Blocked by gmail. By the time I authorized the access, I was blocked by "too many attempts" so will have to try this again tomorrow.

@jaaabeee
Copy link

jaaabeee commented Jun 4, 2020

BTW, I tried port 465 for iCloud (SSL) rather than the normal 587 (TLS) port. Instead of the previous traceback, I got a timeout:


Traceback (most recent call last):
  File "/home/pi/python/ven/bin/outage_detector", line 10, in <module>
    sys.exit(main())
  File "/home/pi/python/ven/lib/python3.7/site-packages/outagedetector/__main__.py", line 18, in main
    config.initialize()
  File "/home/pi/python/ven/lib/python3.7/site-packages/outagedetector/initial_config.py", line 71, in initialize
    "Mail sent successfully!", json_data["smtp_server"], password, json_data["port"])
  File "/home/pi/python/ven/lib/python3.7/site-packages/outagedetector/send_mail.py", line 40, in send_mail
    with SMTP_SSL(smtp_server, port, context=context) as server:
  File "/usr/lib/python3.7/smtplib.py", line 1031, in __init__
    source_address)
  File "/usr/lib/python3.7/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.7/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.7/smtplib.py", line 1037, in _get_socket
    self.source_address)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

@jaaabeee
Copy link

jaaabeee commented Jun 4, 2020

Final update: Gmail won't allow this to work because it considers the app to be less secure than its usual standard. I could modify my Gmail account to permit less secure app access, but this makes the account more vulnerable. So for the moment, I'm unable to use the outage_detector with either of my email accounts.

@nevillator-999
Copy link
Author

I was not able to get it to setup through gmail either. I have it running with Pushbullet and as Safari Notification, but I'd prefer to get it going through email of some sort.

@jaaabeee
Copy link

jaaabeee commented Jun 4, 2020

My understanding was that PushBullet isn't an option for iPhone, so still working on getting email to work for me. Am on new Pi4, only thing installed is pi-hole, running commands from YouTube video...

@fabytm
Copy link
Owner

fabytm commented Jun 4, 2020

Pushbullet used to be on the App store but it seems they removed it. I.'ve downloaded it a long time ago so I can still use it.

@nevillator-999 You said you couldn't get it to work with gmail. Could you share the exception it threw?

@jaaabeee I made a separate gmail account just for the purpose of automated mails, so I turned that feature off on that account.

@dioncm-code
Copy link

dioncm-code commented Jul 8, 2020

I was having similar issues but was able to resolve by using my gmail as the outgoing mail, with a 2 factor authentication for security and with an app specific password. I tried allowing less secure to connect with gmail but in the end, only the two factor authentication and specific app password worked. I used my iCloud account for the receiving mail. It worked and I got the test email. However, I have other issues as mentioned in the first issue thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants