Emailing from a server typically requires setting up a mailserver on that machine, and that in itself can be a challenging process. If you are using a server that is run by a hosting service, they systems admins take care of that mess.
And email is a huge mess for lots of different reasons.
Still, email is the de facto standard in digital communication, so we need to be able to use it. Let's get our server to send mail to us. And rather than run our own mailserver, we'll let Google's Gmail do the heavy lifting.
Let's get started!
Create a new Gmail account that we'll be using with our server. You don't want to risk using your personal or school Gmail account for this project: it something goes wrong and your server account gets killed/banned, we don't want that to affect your real life.
As part of this process, you'll want to reset the security settings on that account to allow for "insecure" access. You can do this by logging into your server Gmail account, going to your Settings, and going into the Sign-in and security section:
My Account > Sign-in & security > Allow less secure apps: ON
Clone the zip file for the project github.com/rwhite5279/pythonGmail onto your computer and take a look at the script there. We're going to modify that script so that our server can email us.
You can also see a copy of the script right here.
Copy the file to your server, perhaps into a folder called email_script, and see if you can get it email you a simple "hello" message at your Polytechnic email address.
You can use SMS (Simple Message Service) or MMS (Multimedia Message Service) along with a mobile phone service's gateway to have your email delivered as a text to your phone. See this article for a list of gateways for common carriers.
My mobile phone is on Verizon, so I changed the PythonGmail script to send a message to my 10-digit phone number at 6265900513@vzwpix.com