O'Reilly logo

Learning BeagleBone Python Programming by Alexander Hiam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SMTP

We've looked at various forms of displays that you can attach to your BeagleBone, but those are only useful when you're looking at it. If your BeagleBone is not accessible, for instance, it's monitoring something at your home while you're out, you might still need a way for it to send you information. One simple way to achieve this is to use Simple Mail Transfer Protocol (SMTP) to send e-mails from your BeagleBone. Save this code to a new file called email_sender.py by filling in your account's SMTP details:

import smtplib from email.mime.text import MIMEText SMTP_host = 'smtp.gmail.com' SMTP_email = 'username@gmail.com' SMTP_pass = 'password' def send_email(to, subject, body): msg = MIMEText(body) msg['Subject'] = subject msg['From'] = SMTP_email ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required