0

[I've asked this on StackOverflow and was advised to put it on here.]

I have created a HTML email signature, in Exchange Admin Center, that uses variables to get data from active directory. But, if any of these variables are empty the signature displays a blank space.

Is there any way - preferably without javascript (if possible) - to say if the variable is empty/null then don't display that line of content.

For example, if the email field is empty the signature will display 'E: [blank space]'. I'd rather it not display the Email line. The images are probably more helpful.

Here is the code [snippet] I'm using in the signature that I want to put conditions on...

<div class="all-info" style="float: left; padding-left: 5px;padding-top: 15px">
   <h3 style="margin: 0px; color: #DB0E15">%%FirstName%% %%LastName%%</h3>
   <h4 style="margin: 0px; padding: 3px 0px 6px 0px;">%%title%%</h4>
   <h5 style="margin: 0px; padding-bottom: 5px;"><span style="color: #DB0E15">E : </span>%%email%%</h5>
   <h5 style="margin: 0px; padding-bottom: 3px;"><span style="color: #DB0E15">T : </span>%%PhoneNumber%%</h5>
</div>

Note: It needs to work in Outlook as well as other clients/browsers.

Below are images to try and explain my problem better.

Signature when email not blank

Notice in this image, the line with email content is displayed with a blank email address. Which is when I don't want the line to appear.

Signature with blank email - don't want this line appearing

Here is the HTML I am using...

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <style type="text/css">
        table td { border-collapse: collapse; }
        .msoBord { mso-table-lspace:-1pt; mso-table-rspace:-1pt; border-right-color: #DB0E15; border-right-style: solid; border-right-width: medium;}
        .msoFix { mso-table-lspace:-1pt; mso-table-rspace:-1pt;}
    </style>
</head>
<body style="margin: 0px; padding: 0px; background-color: white;" bgcolor="white">
    <font face="Arial">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td align="left">
              <div style="max-width:700px !important;">
                <table class="msoBord" width="120" cellpadding="0" cellspacing="0" align="left" bgcolor="white" >
                  <tr>
                    <td align="left" style="padding: 0px;">
                    <a href="https://[our.web.address]/"><img src="[link to image]" alt=""></a>
                    </td>
                  </tr>
                </table>
                <table class="msoFix" width="380" cellpadding="0" cellspacing="0" align="left" bgcolor="white">
                  <tr>
                    <td align="left" style="padding: 5px;">
                    <div class="all-info" style="float: left; padding-left: 5px;padding-top: 15px">
                        <h3 style="margin: 0px; color: #DB0E15">%%FirstName%% %%LastName%%</h3>
                        <h4 style="margin: 0px; padding: 3px 0px 6px 0px;">%%title%%</h4>
                        <h5 style="margin: 0px; padding-bottom: 5px;"><span style="color: #DB0E15">E : </span>%%email%%</h5>
                        <h5 style="margin: 0px; padding-bottom: 3px;"><span style="color: #DB0E15">T : </span>%%PhoneNumber%%</h5>
                    </div>
                    </td>
                  </tr>
                </table>
              </div>
            </td>
          </tr>
        </table>
    </font>
</body>
Matt
  • 91

0 Answers0