emails from command prompt.
doug.dastew at gmail.com
Thu Jun 15 16:29:01 UTC 2017
> Thanks for the all the help.
I have some python code and a bash script to run it, and it works great.
My overall project was to see when my wan address changes and email me the
new wan IP address.
this allows me to ssh in or vnc in when traveling. I only have a dynamic
this code will run ever 10 min. at home and does not involve the internet
until my IP changes.
#import os, sys
p=subprocess.Popen("curl ipinfo.io/ip", shell=True, stdout=subprocess.PIPE,
print "Current IP = "+ q
file = open("wanipadds.txt", "r")
oldip = file.read()
print "now for oldip = " + oldip
if oldip != q :
print "New IP found!!! "
file = open("wanipadds.txt", "w")
from email.MIMEMultipart import MIMEMultipart
server = smtplib.SMTP('smtp.gmail.com', 587)
server.login("doug.dastew at gmail.com", "password")
SUBJECT = " IP Address is = "+ q
msg = MIMEMultipart()
msg['Subject'] = SUBJECT
server.sendmail("doug.dastew at gmail.com", "doug.dastew at gmail.com",
My email looks like this
IP Address is = 22.214.171.124
Thanks again and if anyone wants this code it is free!!!!!
DAS[image: Certificate for 206392]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ubuntu-ca