Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Sending Emails using WiFi (GPy)

    Scheduled Pinned Locked Moved GPy
    emailgpywifisend data
    1 Posts 1 Posters 46 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Akul9092
      last edited by

      Hi,
      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 = 'recipient@gmail.com'
          user = 'sender@gmail.com'
          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.

      Tutorial

      Thanks

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom