Phone Notification: Send things to phones!

This is an application that sends messages to phones. All you have to do is add an email to the first line (you’ll see), and add this to the resources of your app.

DOES NOT WORK! BEING EDITED! Here is how you call it from your app:

tell application "WhatIcallit" to main("My notification here")

end DOES NOT WORK! BEING EDITED! :smiley:

The application (save as stay open and run only for password protection):

property login : {name:"emailhere@example.com", password:"mypasswordhere", smtp:"smtp.example.com"} -- replace with a SMTP email address
property site : "http://www.mactweaks.info/notification/" -- a demo, download, unzip, then add http://mactweaks.info/files/notification.zip to your site and set this to the path to the folder
property email : missing value
property l : missing value
property x : missing value

on main(notification)
	if email is missing value then set {l, x} to {missing value, missing value}
	set {email, carrier} to processnumber()
	log email
	if (email as «class utf8») is not in (paragraphs of (do shell script "curl " & site & "/get.php")) then
		setup()
		do shell script result
	else
		do shell script quoted form of (POSIX path of (path to resource "sendEmail")) & " -f \"" & (system info)'s long user name & "<" & login's name & ">" & "\" -t \"" & email & "\" -m " & notification & "  -s " & login's smtp & " -o username=" & login's name & " -o password=" & (login's password)
	end if
	return result
	quit
end main

on setup()
	set {email, carrier} to processnumber()
	log email
	set message to quoted form of "Do you want to add your account to the service? If yes: " & site & "addemail.php?email=" & email
	log message
	display dialog "This service provides your phone an instant access to your newest updates. Your carrier might charge you for using this service. Would you like to continue?" buttons {"No", "Yes"} default button "Yes" cancel button "No" with title "Charges may apply"
	repeat
		display dialog "Is " & email & " and OK email? Phone emails should look like this: 8005551234" & carrier buttons {"Change Number", "Send Registration"}
		if button returned of result is "Change Number" then
			set l to missing value
			set x to missing value
			set {email, carrier} to processnumber()
		else
			exit repeat
		end if
	end repeat
	return quoted form of (POSIX path of (path to resource "sendEmail")) & " -f \"" & (system info)'s long user name & "<" & login's name & ">" & "\" -t \"" & email & "\" -m " & message & "  -s " & login's smtp & " -o username=" & login's name & " -o password=" & (login's password)
end setup

on processnumber()
	if l is missing value then set l to text returned of (display dialog "What is your phone number? Incorrect format will not work." default answer "1 (800) 555-1234" buttons {"Cancel", "OK"} default button "OK")
	if x is missing value then set x to (choose from list {"Alltel", "AT&T", "Boost Mobile", "Cricket Wireless", "Nextel", "Sprint", "T-Mobile", "U.S. Cellular", "Verizon", "Virgin Mobile USA"} with prompt "Select your phone's carrier:") as string
	if x is "Alltel" then set carrier to "@message.alltel.com"
	if x is "AT&T" then set carrier to "@mms.att.net"
	if x is "Boost Mobile" then set carrier to "@myboostmobile.com"
	if x is "Cricket Wireless" then set carrier to "@sms.mycricket.com"
	if x is "Nextel" then set carrier to "@messaging.nextel.com"
	if x is "Sprint" then set carrier to "@messaging.sprintpcs.com"
	if x is "T-Mobile" then set carrier to "@tmomail.net"
	if x is "U.S. Cellular" then set carrier to "@email.uscc.net"
	if x is "Verizon" then set carrier to "@vtext.com"
	if x is "Virgin Mobile USA" then set carrier to "@vmobl.com"
	return {((do shell script "echo " & quoted form of (text ((offset of "(" in l) + 1) thru -1 of l) & " | tr -d ')'-' '") & carrier), carrier}
end processnumber