How to Update Outlook Signature Automatically

I created a fun little program a while ago. It updates my Outlook signature with the current temperature in Melbourne, Australia. Here is C# source code:
class Program
    static void Main(string[] args)
            decimal temperature = GetCurrentTemperature();
        catch (Exception e)
            Environment.ExitCode = 1;

    private static decimal GetCurrentTemperature()
        var webClient = new WebClient();
        webClient.Headers.Add("user-agent", "Mozilla");
        string json = webClient.DownloadString("");
        dynamic observations = new JavaScriptSerializer().DeserializeObject(json);
        return observations["observations"]["data"][0]["air_temp"];

    private static void UpdateSignature(decimal temperature)
        const string SignatureFile = @"C:\Users\pchuchuv\AppData\Roaming\Microsoft\Signatures\Temperature.htm";
        string signature = File.ReadAllText(SignatureFile);
        string newSignature = Regex.Replace(signature, "Pavel<br>.*</p>",
            Math.Round(temperature, MidpointRounding.AwayFromZero)));
        File.WriteAllText(SignatureFile, newSignature);

The program fetches the temperature from Australia’s Bureau of Meteorology (BOM) website. I created a Visual Basic Script to run so that I don’t see a black console window every time the programs gets executed:
CreateObject("Wscript.Shell").Run "C:\etc\TemperatureToSignature.exe", 0, True
Open Outlook options, switch to Mail tab and click ‘Signatures’ button:
Create a new signature and give it ‘Temperature’ name. Edit the Temperature.htm file in C:\Users\<your username>\AppData\Roaming\Microsoft\Signatures folder and make sure it has this line:
<p class=MsoAutoSig>Pavel<br></p>
Don’t forget to change Pavel to your name 🙂 Next, open Task Scheduler.
  • Create a new task
  • Define a schedule to run every hour from 7:11
  • Select .vbs file as ‘Program/script’
Now every time you create a new email or hit reply button you will see the temperature:


Leave a Reply

Your email address will not be published. Required fields are marked *