This post is mostly the equivalent of one of a previous post which initially was in bash.
some variables required to be set, such as follow:
me = "sender_email_address_from_gmail" pas = "password_for_sender" you = "recipient_email_address" path = "/root"
As for the entire script, it’s available here: sendemail_ip_in_python
Additionally, you may want to send also a notification through Hangout however, as for this to work you will require to install sendxmpp locally.
As for a starting point:
As part of the python script. Add the following at the top:
Then after this line (line 82)
print(“- EMAIL HAS BEEN SET TO: %s”) %you
bashCommand = "echo 'IP Changed: %s' | /usr/bin/sendxmpp -t -u sender_gmail_id -o gmail.com recipient_gmail_id" % ip output = subprocess.check_output(['bash','-c', bashCommand])