Sizar
Sizar

Reputation: 23

JavaScript in Microsoft Outlook signature

I'm trying to run html signature with javascript in outlook 2013. In the browser it works, but when I'm opening it in Microsoft Outlook it's giving me empty mail. So my question is: Is it possible to run js in outlook? Code with example image is given below

<!DOCTYPE html>
<html>
<head>
<title>Signature</title>
</head>
<body>

<script>
    var img = new Image();
    var firstPartOfLink = 'http://www.devinrolsen.com/google-maps-marker-icon-counter/marker-maker.php?fontType=ARIAL&fontSize=23&x=16&y=65&r=0&color=255,255,255&image=custom-pin.png&text=Example?';

    var now = new Date();
    var start = new Date(now.getFullYear(), 0, 0);
    var diff = now - start;
    var oneDay = 1000 * 60 * 60 * 24;
    var day = Math.floor(diff / oneDay);
    var stamp = 'stamp=' + day;
    var queryString = firstPartOfLink + stamp;
    
    img.src = queryString;
    
    document.body.appendChild(img);
</script>

</body>
</html>

Upvotes: 2

Views: 4548

Answers (1)

Radek Pech
Radek Pech

Reputation: 3098

Emails cannot/shouldn't contain javascript because

  1. security reasons (imagine what spam could do with scripts)
  2. not all (desktop) email clients contain or support javascript

see JavaScript and Emails

Upvotes: 2

Related Questions