'* by Don Starkey, 8/4/2016 *
'* Get current time as ASCII String from internet *
'* Send it as a text message to my phone *
'******************************************************
print "Connected to AP"
' Get ASCII time string
Traw = wget("tycho.usno.navy.mil/timer.html")
' Search for marker so we know where to trim
P = instr(Traw,"Universal Time")
' Get formatted string for "Eastern Time" formatted properly
Time = mid(Traw,P + 19,24)
Print "Time: " & Time
' result: "Aug. 05, 03:39:22 PM EDT" in Time variable
' Now, lets send it as a text message
body = Time
' Fill in your SMTP server
server = "mail.xxx.com"
port = 25
user = "yourname@yourserver.com"
password = "yourpassword"
' Fill in where you want your text message sent
' I use Verizon so vtext.com works
sendto = "5551234567@vtext.com"
' Who the message is from, server might need this???
sendfrom = "me@server.com"
mess = "Message from ESP8266: "
print "Sending Message"
setupemail server port user password
print "Set up email server"
email sendto sendfrom mess body
print "Message sent"
end