Sending email from WiPy
Posted: Sat Apr 07, 2018 12:35 pm
Hi All
This question has been asked before, but the solutions given in this forum don't appear to be working for me. I am trying to send an email from my wipy 1.0 using gmail smtp and I attempt to implement the solution on page 2 of this topic: viewtopic.php?f=11&t=1047&start=10
I have downloaded the stripped down smtplib and attempt to use the accompanying code in the topic linked above.
When I run this on my laptop using port=465 and Tls = True, I can send an email. This surprised me somewhat because according to gmail's website (https://support.google.com/a/answer/176600?hl=en) one should connect to port 587 when using tls!!! Anyway....
When I upload the code onto the wipy and attempt to execute [port = 465, Tls = True] the code fails at the call to SMTP->get reply with the message SMTPServerDisconnected: Connection Unexpectedly Closed
I'm suprised I'm getting a different behaviour depending on whether I run the code on my laptop or on the wipy. I wondered if gmail is able to block certain IPs... but I can't see anyway of managing this in my gmail account.
On my wipy, I also try running the code with port=587, Tls = True (to better reflect the advice on gmails website). The code manages to execute SMTP and helo but fails at login. I get the message SMTPAuthentificationError: (530, b'5.7.0 Must issue a STARTTLS command first.... {I noted that in the topic linked above specific mention was made of not needing to call starttls, it also states that when using Tls one should use port 465 which I am struggling to reconcile with gmail's advice to use port 587 when using tls)
I tried calling smtpserver.starttls() after helo and before login.... then I get SMTPAuthentificationError: (-1, b'\x02\x02F')
Any thoughts? I'm new to all of this and naively assumed that sending emails from an IoT board would be essential.
This question has been asked before, but the solutions given in this forum don't appear to be working for me. I am trying to send an email from my wipy 1.0 using gmail smtp and I attempt to implement the solution on page 2 of this topic: viewtopic.php?f=11&t=1047&start=10
I have downloaded the stripped down smtplib and attempt to use the accompanying code in the topic linked above.
When I run this on my laptop using port=465 and Tls = True, I can send an email. This surprised me somewhat because according to gmail's website (https://support.google.com/a/answer/176600?hl=en) one should connect to port 587 when using tls!!! Anyway....
When I upload the code onto the wipy and attempt to execute [port = 465, Tls = True] the code fails at the call to SMTP->get reply with the message SMTPServerDisconnected: Connection Unexpectedly Closed
I'm suprised I'm getting a different behaviour depending on whether I run the code on my laptop or on the wipy. I wondered if gmail is able to block certain IPs... but I can't see anyway of managing this in my gmail account.
On my wipy, I also try running the code with port=587, Tls = True (to better reflect the advice on gmails website). The code manages to execute SMTP and helo but fails at login. I get the message SMTPAuthentificationError: (530, b'5.7.0 Must issue a STARTTLS command first.... {I noted that in the topic linked above specific mention was made of not needing to call starttls, it also states that when using Tls one should use port 465 which I am struggling to reconcile with gmail's advice to use port 587 when using tls)
I tried calling smtpserver.starttls() after helo and before login.... then I get SMTPAuthentificationError: (-1, b'\x02\x02F')
Any thoughts? I'm new to all of this and naively assumed that sending emails from an IoT board would be essential.