Hack95.Send Email and SMS Notification of New Voicemail


Hack 95. Send Email and SMS Notification of New Voicemail

Don't let Skype voicemail languish, unheard for hours or perhaps even days. Get timely notifications of newly arrived Skype voicemail by automatically sending an email/SMS message to your handheld or mobile phone.

Works with: Windows and Mac OS X versions of Skype.

If you move around a lot with a handheld device that has email but doesn't run Skype (for example, a Palm PDA), or if you carry a Short Message Service (SMS)-enabled phone, you can get timely notification of the arrival of new Skype voicemail using the following scripts. Once you receive notification, go to the nearest machine running Skype, log on, and you'll be able to listen to your newly arrived voicemail.

When you log onto Skype on a machine that is not your own, Skype downloads new voicemail and other files to that machine's hard disk. These files are not encrypted, so you might want to delete them safely before leaving the borrowed machine (see "Erase a Skype User Account" [Hack #98]).


The scripts work just as well for mobile phones. Most mobile phones with SMS have an email gateway so that any short email message sent to the gateway is converted into an SMS message and is forwarded to your phone. For example, sending an email to one of these email gateways will deliver an SMS message to the mobile phone with the number specified (PhoneNumber):


T-Mobile

PhoneNumber@tmomail.net


Virgin Mobile

PhoneNumber@vmobl.com


Cingular

PhoneNumber@cingularme.com


Sprint

PhoneNumber@messaging.sprintpcs.com


Verizon

PhoneNumber@vtext.com


Nextel

PhoneNumber@messaging.nextel.com

All of the scripts in this hack continuously monitor the folder into which Skype puts its voicemail files. Each time a new file appears in the folder, the scripts send off a short email to your portable deviceindeed, to any device or devices that are email enabled!

The scripts in this hack work by constantly monitoring the folder that Skype uses to download voicemail files for newly arrived voicemails. Whereas the Windows and Mac OS X versions of Skype download voicemail files immediately, the Linux version does not do so until the user actually plays a voicemail message. That is why the scripting technique used in this hack won't work on Linux.

Normally, Skype stores voicemail files in these folders:


Windows

C:\Documents and Settings\LogonName\Application Data\Skype\SkypeName\voicemail


Mac OS X

/Users/LogonName/Library/ApplicationSupport/Skype/SkypeName/voicemail

Were Skype to make the audio format of its voicemail public (Skype, if you're reading this, that's a hint), you could easily modify the scripts in this hack to forward via email the newly arrived voicemail as a sound file attachment that could be played on the receiving handheld device. Now that would be cool!


12.6.1. Windows

This script, new_voicemail.vbs, will check your voicemail folder every 30 seconds or so to see whether a new voicemail has arrived. When one does, it sends off a short email message telling you so. It uses the Simple Message Transfer Protocol (SMTP) to send email, because if you try to script Microsoft Outlook, you'll soon be in a world of painbelieve me, don't go that route! To make this script work for you, you will need to make some small changes. But once you've done that, the script will run continuously in the background until you explicitly kill it or shut down your machine.

 ' File: new_voicemail.vbs ' Things you need to change in this script are ' shown like <this>. Const cdoSendUsingPort = 2 ' Send the message using SMTP Const cdoBasicAuth = 1     ' Clear-text authentication Const cdoTimeout = 60      ' Timeout for SMTP in seconds Const cdoPort = 25         ' Port number for SMTP Dim objFSO, objFolder, objFiles, objEmail Dim voicemail_folder, num_voicemails Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") voicemail_folder = "C:\Documents and Settings\<YourLogonName>" & _                    "\Application Data\Skype\<SkypeName>" & _                    "\voicemail" Set objFolder = objFSO.GetFolder(voicemail_folder) Set objFiles = objFolder.Files num_voicemails = objFiles.Count Do     If objFiles.count > num_voicemails Then     Set objEmail = CreateObject("CDO.Message")     ' Message to be sent     objEmail.Subject  = "You have a new Skype voicemail!"     objEmail.Sender   = "<SenderEmailAddress>"     objEmail.To       = "<RecipientEmailAddress>"     objEmail.TextBody = "You have new voicemail…" & _                         VbCr & VbCr & "…logon to " & _                         "your Skype account to " & _                         "listen to your new " & _                         "voicemail message." '---------------------------------------------------------------------         ' SMTP server details         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = _ cdoSendUsingPort         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "<SMTPServerName>"         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = _ cdoBasicAuth         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername") = _ "<SMTPUsername>"         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = _ "<SMTPPassword>"         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = _ cdoPort         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = _ False         objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = _ cdoTimeout         objEmail.Configuration.Fields.Update '---------------------------------------------------------------------         objEmail.Send         Set objEmail = Nothing        End If      num_voicemails = objFiles.count      WScript.Sleep 30000 ' Go to sleep for 30 seconds Loop While True 

12.6.2. Mac OS X

You can attach this AppleScript, new_voicemail.scpt, to a folder actionin this case, the "new item alert" actionthat will run the script every time a new file is added to the Skype voicemail folder. This means that every time a new voicemail arrives, the script uses Mail to send you a notification message.

To set up a folder action, in the Finder locate the Skype voicemail folder, Ctrl-Click on it, choose Attach a Folder Action…, and then attach the new_voicemail.scpt script. Now, every time a new voicemail arrives, you'll know about it wherever you might be. This script will run on action until you disable or delete the folder action with which it is associated. Even after rebooting, it'll still be there, doing its job!

To have new_voicemail.scpt available as a folder-action script, you must put it in the folder-action scripts folder, /Library/Scripts/Folder Action Scripts/:

 -- File: new_voicemail.scpt -- Things you need to change in this script are -- shown like <this>. on adding folder items to this_folder after receiving added_items     try         tell application "Mail"             -- Send mail immediately             set displayForManualSend to false             -- Mail header             set email_to to "<RecipientEmailAddress>"             set email_from to "<SenderEmailAddress>"             set email_subject to "You have new Skype voicemail!"             -- Mail body             set email_body to return & return & 

"You have new voicemail…" &

return & return &

"…logon to your Skype account " &

"to listen to your new voicemail message." -- Create the e-mail set msg to make new outgoing message tell msg make new to recipient at beginning of

to recipients

with properties {address:email_to} set the sender to email_from set the subject to email_subject set the content to email_body end tell send msg end tell end try end adding folder items to




Skype Hacks
Skype Hacks: Tips & Tools for Cheap, Fun, Innovative Phone Service
ISBN: 0596101899
EAN: 2147483647
Year: 2005
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net