Get HTML to pull information from AD to generate an email signature

Hi Experts,

I have created an HTML signature and worked hard on the format. Active directory attributes should be pulled in order to generate the signature details. when I run the code, I get the format I want but nothing is pulled from AD.

This code did run ok when I used as a disclaimer rule on office 365.

I have attached the code, can someone guide me on how to make the HTML code pull the attribute from AD.

I did connect to AD via powershell and tried to run the code but no luck.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Email Signature</title>

</head>

 

<body>

<div style="font-size:9pt;  font-family: 'Helvetica',sans-serif;">

<br> </br>

<p><strong><img src="https://www.mycompany.com/wp-content/uploads/2016/12/eb-logo-email-sig-01.png " width="174" height="37" alt="" /></strong></p><br>

<strong>%%Displayname%%</strong> / %%title%% <br>  

<a href="mailto:%%email%% "><font color="#D01f29">%%email%%</font></a><br />

<br>

<strong>%%Company%%</strong> <br>  

%%Phonenumber%% <br>  

%%Street%% <br>  

%%City%%, %%State%%,%%Zipcode%%, %%Country%% <br>  

<a href="https://www.mycompany.com/" target="_blank"><font color="#D01f29">www.company.com</font></a> <br />

<br>

<a href="https://twitter.com/company" target="_blank"><img src="https://s3.amazonaws.com/htmlsig-assets/round/twitter.png" alt="" width="24" height="24" border="0" /></a>&nbsp; <a href="https://www.facebook.com/companyinc" target="_blank"><img src="https://s3.amazonaws.com/htmlsig-assets/round/facebook.png" alt="" width="24" height="24" border="0" /></a>&nbsp; <a href="https://www.linkedin.com/company/3388?trk=tyah&amp;trkInfo=clickedVertical%3Acompany,clickedEntityId%3A33883,idx%3A2-1-4,tarId%3A1439926026058,tas%3Acompany" target="_blank"><img src="https://s3.amazonaws.com/htmlsig-assets/round/linkedin.png" alt="" width="24" height="24" border="0" /></a><br><br>

<em>This email may contain confidential  and/or proprietary information. Access to this e-mail by anyone other than the  intended recipient is unauthorised. If you are not the intended recipient (or responsible  for delivery of the message to such person), you may not use, copy, distribute  or deliver this message or any of its contents to anyone or take any action in  reliance on it</em>

</div></body>

</html>

Open in new window

signature-experts.htm
Abbas HaidarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ExclaimerCommented:
Hi there,

Can you confirm where you are running the code please? You mentioned it worked in an Office 365 transport rule and as this question is tagged with ‘Office 365’, we just want to find out where this is not working.

All the best,

Exclaimer
0
Abbas HaidarAuthor Commented:
Basically, the aim is to get the users to run the .html code in order to generate their email signature on their desktop ( office 365 was an example to prove that the code works if connected to AD, I will take that tag out). It will be ideal to have this as a page where a user enter his username and password and it will generate his signature according to his AD credentials.
0
ExclaimerCommented:
Unfortunately the above will not work. It will simply open a HTML page showing either the design or the flat code. You won't be able to simply run an HTML file like you can a PowerShell command. To run something like this over PowerShell, you will need to use PowerShell commands to query your AD and build your signature.

You could always try one of our email signature solutions to do make this process easier if you were interested in looking at a third-party product.

https://www.exclaimer.com/exclaimer-cloud/signatures-for-office-365/
https://www.exclaimer.com/signature-manager-exchange-edition/
https://www.exclaimer.com/products
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Abbas HaidarAuthor Commented:
Thank you, I dont want to use a third party. I am looking to use PowerShell commands to query AD and build your signature using the html format as an output. is that possible?
0
CodeTwo SoftwareSoftware DeveloperCommented:
Hi Abbas,

It will be ideal to have this as a page where a user enter his username and password and it will generate his signature according to his AD credentials.

This sounds like it would require a whole online application. Before you go this route, see if the VBS solution mentioned by Shaun is close enough.

Alternatively, you could try this:

1. Deploy an Office 365 disclaimer using your code (http://mail-signatures.com/articles/configuring-organization-wide-email-signatures-in-office-365/?sts=6614), but configure it to be added only to the first email.

You can do this by defining an exception: Except If > The subject or body matches these text patterns > "This email may contain confidential  and/or proprietary information"

2: Ask users to send 1 email to themselves and copy the disclaimer into the email signature box on their email clients BUT set it to add only to replies and forwards (https://www.groovypost.com/tips/outlook-make-signature-display-replying-forwarding-email/)

You can also send this email automatically using PowerShell:

foreach ($AllMailboxes in (Get-Mailbox)) { $Name=$AllMailboxes.Name; $UserSMTP=$AllMailboxes.PrimarySmtpAddress; send-mailmessage -to "$Name <$UserSMTP>" -from "$Name <$UserSMTP>" -subject "Email signature + instructions" -bodyasHTML -body "%instructions%" -smtpServer %Your SMTP server FQDN% }

Open in new window


Best regards,
CodeTwo
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.