Sending Emails using WiFi (GPy)
Looks like Singapore only allows businesses to use their CAT-M1 and NB-IOT services so I am stuck with WiFi. If I am not wrong, the only way of communicating with other devices is through email. I found a tutorial online on how to send an email using Pycom and here's the code:
def sendEmail(): to = 'email@example.com' user = 'firstname.lastname@example.org' pwd = 'password' smtpserver = smtplib.SMTP("smtp02.hostnet.nl", 587, tls=False) smtpserver.login(user, pwd) header = 'To:' + to + '\n' + 'From: ' + user + '\n' + 'Subject: Email from the GPy \n' msg = header + '\n Hi, \n this is The GPy emailing ;-) \n\n Cheers, \n The GPy' smtpserver.sendmail(user, to, msg) print("Check Inbox!") smtpserver.close()
However, in the terminal, I am greeted by the following error message:
File "<stdin>", line 72, in sendEmail File "/flash/lib/smtplib.py", line 259, in login SMTPAuthenticationError: (535, b'authorization failed (#5.7.0)')
Line 72 refers to
header = 'To:' + to + '\n' + 'From: ' + user + '\n' + 'Subject: Email from the GPy \n'
My suspicion is that the user and pwd or not meant to be email and the corresponding password but something else.
Is there an alternative way of sending an email or is there a workaround?
Also, is there maybe another way of communicating with devices through wifi instead of emails?
Note, I did use legitimate email addresses and the correct password.