Windows Mail on Vista – Simple MAPI send problem

If your application will not send emails using Windows Mail on Windows Vista, it’s worth checking if Windows Mail is set as the default email client. To check if Windows Mail is set as the default:

  1. Run Windows Mail by clicking Vista’s Start button then choosing All Programs. Then click on Windows Mail.
  2. When Windows Mail appears, click on its Tools menu and choose Options.
  3. In the General tab, look under the Default Messaging Programs section at the bootm. If the Make Default button next to “This application is the default Mail handler” is checked, Windows Mail should be the default email client on the PC.
  4. If the Make Default button is enabled, press it to make Windows Mail the default on your PC.
  5. Click OK to close the Options dialog.

It’s also worth checking the default settings in Vista’s start menu …

  1. Click on Vista’s Start button then choose the Default Programs option.
  2. Choose the Set your default programs option.
  3. In the window that appears, choose Windows Mail.
  4. Click the Set this program as default option that appears on the bottom right of the window.

After following the procedures above, if Windows Mail should work properly when another application on your PC uses Window’s Simple MAPI service to send emails.

For help on sending emails using Windows Live Mail on Windows 7, check this blog post.

Splitting a time value into day, hour, mins, secs in PHP

I’ve been writing a new webpage that calculates the time left before a user license period expires. I wanted to display the time as a countdown of the number of days left before the license runs out. I couldn’t find an off-the-shelf PHP function to do the job so I quickly wrote the function below.

/* This function takes a PHP time value and returns the duration as an array
with 4 elements -
element 0 = days
element 1 = hours
element 2 = minutes
element 3 = seconds
function DurationInDHMS($timeduration)
    $days = floor($timeduration / 86400);
    $timeduration = $timeduration - ($days * 86400);
    $hours = floor($timeduration / 3600);
    $timeduration = $timeduration - ($hours * 3600);
    $minutes = floor($timeduration / 60);
    $seconds = $timeduration - ($minutes * 60);
    return array($days, $hours, $minutes, $seconds);