Like the OpenCV library to work with images and camera on BeagleBone Black with Python, we have many other wonderful libraries that are developed and are built in Python. One such library is the SMTP e-mail library, which we will be using in this section.
To test this, we will use the image we captured in the project in the previous chapter, available inside the ImageCapture
folder.
We will change our working directory to the ImageCapture
directory first, as shown in the following screenshot, using cd ImageCapture
:
Then, we will go ahead and create a Python file with code to send an e-mail with an attachment in it. To do that, first create a new file named sendemail.py
, using sudo nano sendemail.py
:
Now, type in the code shown in the following screenshot and save the file inside the ImageCapture
folder itself. The code has been written with comments on most of the lines for you to get a clear idea of how it works.
You'll see that the Photo...