Sending SMTP Email



  • Is there a straight forward micro python script or lib for sending email on Gpy, or Wipy, or Lopy?

    We currently use the following code with Python 3 smtplib on RaspberryPi;

        server = smtplib.SMTP('mailserver',port,'',5)
        print ('Connected to the smtp server, trying to log on...')
        server.ehlo(host)
        print ('Sent ehlo')
        server.login(smtp_user, smtp_password)
        print ('Logged onto smtp server, trying to send email...')
        server.sendmail(fromaddr, recipients, message)
        server.close()


  • I have email send method implemented in my MycroPython port as a part of the curl module.
    I think it could be easily ported to Pycom's MicroPython (curl_mail.c, modcurl.c)...



  • We have a number of modules (Gpy, Wipy, and Lopy) all of which we are using WiFi. We need to send an email on an event (GPIO going hi or lo as an example). For Micro Python we cannot find any smtp libraries. We see a dummy smtplib but we cannot find any functional smtplib for Micro Python that can run on Gpy, Wipy, or Lopy.

    Are there any such libraries like Python 3 version of smtplib to send email via WiFi for Micro Python?



  • @guyc usually, one would rather do it from a server, and trigger that from the device using a webservice or the network-specific equivalent (you won’t be doing SMTP over LoRaWAN...).

    But if you absolutely want to do it (I would recommend doing so only if you have WiFi avalaible), what issue are you having with smtplib? Are you getting an error? If so, which?


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter