Email Sending using Python Code
Introduction: There are many cases when it can be very useful to be able to send emails from the Raspberry Pi to arbitrary recipients. This is not the same as having a real MTA running on the Pi, which can also receive and store emails. In the following we are only going to cover the possibility of sending emails, not receiving.
Sending out emails from the Raspberry Pi can come in handy in many situations like if some sensors are connected to the GPIO pins of the Pi and it is programmed to send an email when the sensor data in the environment changes from certain threshold values, Pi may send emails with summarized system data.
Another application may include a webcam connected with RaspberryPi set up with some motion detection software, which would send an email as soon as it detects motion in a given area of some closed area.
Install a simple tool for sending emails called SSMTP, to send mails to chosen recipients.
Many email servers today have very strict rules for accepting emails. For example if the email is not coming from a machine with a static IP address, they might classify the email as SPAM.