MarkDH102
Posts: 340
Joined: Fri Feb 13, 2015 3:18 pm

[SOLVED] Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 7:11 am

My Python app keeps failing to send it's daily email to me. Receiving emails is fine.
Claws says "Unknown host" when I try to send, receive is fine

My email address is [email protected]
Claws (3.11.1) is set up to use :
IMAP4
smtp-mail.outlook.com
Use starttls

It has all been working for a few years this way. I've changed nothing. Apart from regular update/upgrade.

Can anyone suggest what has gone wrong? I am out of my depth.
3 of my Pi's are doing the same thing as of this morning. They all worked yesterday. All running Jessie.

Cheers.

I can access my email account via the Edge browser is Windows and send emails fine.

On a secondary matter, the search box on the forum no longer works for me. It just times out with a screen saying "Too much traffic" or words to that effect...
Last edited by MarkDH102 on Fri Sep 08, 2017 6:02 am, edited 1 time in total.

SkyRise
Posts: 179
Joined: Tue Jan 24, 2012 1:20 pm

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 7:43 am

I would expect it's something has changed at Microsoft (outlook.com). You probably need to be searching there...

MarkDH102
Posts: 340
Joined: Fri Feb 13, 2015 3:18 pm

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 7:46 am

I've checked the Microsoft settings as I thought that might be the issue but it appears nothing has changed.
I've just booted my Stretch Pi and it was sending OK yesterday, but same problem today "Unknown host".

User avatar
pi-anazazi
Posts: 526
Joined: Fri Feb 13, 2015 9:22 pm
Location: EU

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 8:09 am

I would not use STARTTLS (due to STRIPTLS attack). And you are much better off with a local eMailserver for status emails. Why let Microtrash know all your internals?

Good time to setup a small email server (I have it installed on a raspi doing some other stuff, use search I had thread on how to set it up here in this forum)...
Kind regards

anazazi

pcmanbob
Posts: 6689
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 9:11 am

I think you will find some thing has changed at Microsoft (outlook.com).

another poster had problems while trying to use ssmtp with it after it had been working OK for a while.

viewtopic.php?f=91&t=191675

I suspect they may have changed something in there security settings which prevents access except via their software or the web page.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

MarkDH102
Posts: 340
Joined: Fri Feb 13, 2015 3:18 pm

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 10:22 am

On my Stretch system I have just changed the SMTP Authentication type from Automatic to LOGIN.
On sending an email, it put up a box about certificates. I accepted the certificate and it sent.

[EDIT] I've just rebooted Stretch and it's back to not sending with the same error.

I tried the same trick on a Jessie system with no luck. Still saying Unknown Host smtp-mail.outlook.com:587.
It is odd, because as soon as I click send, the normal send dialog pops up but is replaced by the error dialogue within less 1s.
I have Thunderbird as a client on my PC (Win 10) and with the same settings as Claws it sends ok.
I can't see Micro$oft nobbling sending in mail clients...
I have checked the time and date on my Pi's and all are correct.
Is it possible to purge certificates?

MarkDH102
Posts: 340
Joined: Fri Feb 13, 2015 3:18 pm

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 11:32 am

And this is the python error if that helps to narrow things down:
Question : How does it now it is a temporary failure?

File "emailtest.py", line 39, in <module
sendAlarmEmail()

File "emailtest.py", line 22, in sendAlarmEmail
server=smtplib.SMTP('smtp-mail.outlook.com', 587)

File "/usr/lib/python3.5/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)

File "/usr/lib/python3.5/smtplib.py", line 335, in connect
self.sock = self._get_socket(host, port, self.timeout)

File "/usr/lib/python3.5/smtplib.py", line 306, in _get_socket
self.source_address)

File "/usr/lib/python3.5/socket.py", line 694, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):

File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

pcmanbob
Posts: 6689
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 2:43 pm

To me that would indicate it can resolve the name 'smtp-mail.outlook.com', 587

but that addresses does not look right to me should it not be 'smtp-mail.outlook.com:587' because 587 is the port you want to connect to.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

MarkDH102
Posts: 340
Joined: Fri Feb 13, 2015 3:18 pm

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 3:33 pm

To me that would indicate it can resolve the name 'smtp-mail.outlook.com', 587

but that addresses does not look right to me should it not be 'smtp-mail.outlook.com:587' because 587 is the port you want to connect to.
I assume that the Python SMTPLIB concatenates the two parameters into the correct string.
I've used this code for 3 years now. And it's odd that Claws doesn't work either. The error in Claws does say smtp-mail.outlook.com:587
4 Pi's (3 * Jessie) and 1 * Stretch all do the same thing.
I've rebooted my router and that's changed nothing.
I've checked the Micro$oft maintenance page for outlook and there's nothing going on there - everything reports as good.

A ping from my Win10 PC gives

C:\Users\MarkH>ping smtp-mail.outlook.com

Pinging outlook-emeawest.office365.com [40.101.76.130] with 32 bytes of data:
Reply from 40.101.76.130: bytes=32 time=57ms TTL=235
Reply from 40.101.76.130: bytes=32 time=56ms TTL=235
Reply from 40.101.76.130: bytes=32 time=56ms TTL=235
Reply from 40.101.76.130: bytes=32 time=55ms TTL=235

Ping statistics for 40.101.76.130:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 55ms, Maximum = 57ms, Average = 56ms

A ping from my Pi gives

[email protected]:~ $ ping smtp-mail.outlook.com
PING outlook-emeawest.office365.com (40.101.51.114) 56(84) bytes of data.
64 bytes from 40.101.51.114: icmp_seq=1 ttl=234 time=70.8 ms
64 bytes from 40.101.51.114: icmp_seq=2 ttl=234 time=76.6 ms
64 bytes from 40.101.51.114: icmp_seq=3 ttl=234 time=85.9 ms
64 bytes from 40.101.51.114: icmp_seq=4 ttl=234 time=73.8 ms
64 bytes from 40.101.51.114: icmp_seq=5 ttl=234 time=82.5 ms
64 bytes from 40.101.51.114: icmp_seq=6 ttl=234 time=76.1 ms
64 bytes from 40.101.51.114: icmp_seq=7 ttl=234 time=77.1 ms
64 bytes from 40.101.51.114: icmp_seq=8 ttl=234 time=77.0 ms
64 bytes from 40.101.51.114: icmp_seq=9 ttl=234 time=82.4 ms
64 bytes from 40.101.51.114: icmp_seq=10 ttl=234 time=85.7 ms
64 bytes from 40.101.51.114: icmp_seq=11 ttl=234 time=77.5 ms
64 bytes from 40.101.51.114: icmp_seq=12 ttl=234 time=76.9 ms
64 bytes from 40.101.51.114: icmp_seq=13 ttl=234 time=77.3 ms
64 bytes from 40.101.51.114: icmp_seq=14 ttl=234 time=75.5 ms
64 bytes from 40.101.51.114: icmp_seq=15 ttl=234 time=76.4 ms
64 bytes from 40.101.51.114: icmp_seq=16 ttl=234 time=74.6 ms
^C
--- outlook-emeawest.office365.com ping statistics ---
16 packets transmitted, 16 received, 0% packet loss, time 15018ms
rtt min/avg/max/mdev = 70.831/77.928/85.984/4.038 ms

Does that give any further useful info?

I really want to get this working again but I don't think it will. It MUST be a Pi problem as Win10 Thunderbird still works with the offending email address.

Thanks for any further help anyone can give me.

hippy
Posts: 5796
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 3:48 pm

MarkDH102 wrote:
Thu Sep 07, 2017 3:33 pm
C:\Users\MarkH>ping smtp-mail.outlook.com
Pinging outlook-emeawest.office365.com [40.101.76.130] with 32 bytes of data:
Not sure if it will help, and it's just a hunch, but seeing as the ping is showing some translation from outlook.com to office365.com you could try sending mail to smtp.office365.com, same 587 port.

MarkDH102
Posts: 340
Joined: Fri Feb 13, 2015 3:18 pm

Re: Pi no longer sending emails (Claws or Python)

Thu Sep 07, 2017 3:55 pm

Not sure if it will help, and it's just a hunch, but seeing as the ping is showing some translation from outlook.com to office365.com you could try sending mail to smtp.office365.com, same 587 port.
BINGO! (At least in the Python code). Thanks. It always helps when someone understands these things...

And it also works in Claws.

Thank you very much for help.

Daveawalker
Posts: 20
Joined: Fri Apr 26, 2013 3:26 pm

Re: [SOLVED] Pi no longer sending emails (Claws or Python)

Fri Mar 02, 2018 7:47 am

Or try smtp.mail.outlook.com ?

Return to “General discussion”