Formating problem with injecting HTML signature into a user (Unknown characters displayed)

462 views
Skip to first unread message

Charles Laverdière

unread,
Oct 13, 2017, 11:27:05 AM10/13/17
to GAM for G Suite
Hello all 

I need help please!

I built HTML files wich contains HTML code for all of my user's signature. Everything is fine when i'm opening the file with chrome, but when GAM set the signature it adds unwanted characters in the final signature output. Here is a screenshot of what the result looks like. 


- You can see the added character just after the logo ()

- Every french canadian character is not recognized (Laverdière, Réseau, Beaupré, Québec)


I looked for a solution to this, and unfortunatly all the solutions I found did not work. Someone on this forum suggested to use the "charset" argument, but it does seem to be excluded from the latest GAM version.


Here is the exact GAM command i'm using: gam user charlesl...@caronetguay.ca signature file charlesl...@caronetguay.ca.html html
Gam returns: Setting Signature for 
charlesl...@caronetguay.ca (1/1)

The signature is added to the user, but with the formating error.


Here is the HTML code used to set the signature:


<head>
<style>
  td{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: .90em;
color: #504F4E;
  }
  .td-allign{
    text-align: left;
border-spacing: 1px
  }
</style>  
</head>

<img src="https://servicesweb.caronetguay.ca/signatures/logo.png" alt="" width="200" height="74" />
<br/>

<table border="0" cellspacing="0" cellpadding="0">

<tr>
<td class="td-allign"><strong>&nbsp;Charles</strong></td>
<td class="td-allign"><strong>&nbsp;Laverdière</strong></td>
</tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="td-allign">&nbsp;Chef assistant du réseau informatique</td>
</tr> 
</table>

<br/>

<table border="0" cellspacing="0" cellpadding="0">
  
   <tr>
     <td class="td-allign"><strong>&nbsp;T</strong></td>
     <td>: (418) 555-5555</td>
<td>#5555</td>
<td>&nbsp;| 1-800-555-5555</td>
   </tr>
   <tr>
     <td class="td-allign"><strong>&nbsp;C</strong></td>
     <td>: (418) 555-5555</td>
   </tr>
   <tr>
     <td class="td-allign"><strong>&nbsp;F</strong></td>
     <td>: (418) 555-5555</td>
   </tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="td-allign">&nbsp;95, Rue de la Distillerie,</td>
<td>&nbsp;Beaupré</td>
<td>&nbsp;(Québec)</td>
<td>&nbsp;G0A 1E0</td>
</tr>
</table>

<br/>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="td-allign">&nbsp;<a href="http://www.caronetguay.com"><strong>www.caronetguay.com</strong></a></td>
</tr>
</table>


- The HTML file is encoded with UTF-8

- Also tried to used a normal text file encoded in UTF-8 and using the HTML parameter.

- I tried to open the file in chrome, extract the HTML code returned by the browser and use it with GAM, same output


Thank you all for any usefull input!

Have a good day








Ross Scroggs

unread,
Oct 13, 2017, 12:05:06 PM10/13/17
to google-ap...@googlegroups.com
Charles,

Please try: gam user charleslaverdiere@caronetguay.ca signature file charleslaverdiere@caronetguay.ca.html charset latin1 html

Ross

On Fri, Oct 13, 2017 at 8:04 AM, Charles Laverdière <charlesl...@caronetguay.ca> wrote:
Hello all 

I need help please!

I built HTML files wich contains HTML code for all of my user's signature. Everything is fine when i'm opening the file with chrome, but when GAM set the signature it adds unwanted characters in the final signature output. Here is a screenshot of what the result looks like. 


- You can see the added character just after the logo ()

- Every french canadian character is not recognized (Laverdière, Réseau, Beaupré, Québec)


I looked for a solution to this, and unfortunatly all the solutions I found did not work. Someone on this forum suggested to use the "charset" argument, but it does seem to be excluded from the latest GAM version.


Here is the exact GAM command i'm using: gam user charleslaverdiere@caronetguay.ca signature file charleslaverdiere@caronetguay.ca.html html
Gam returns: Setting Signature for 
charleslaverdiere@caronetguay.ca (1/1)

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/9cb1aca7-cf4d-411e-94ac-e911851a06ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Charles Laverdière

unread,
Oct 13, 2017, 1:23:49 PM10/13/17
to GAM for G Suite
Hello Ross and thank you for your prompt answer!

I tried your command and was able to use the charset argument with success. However, this charset did not solve the problem. I did some research on common charset and tried them with GAM. The only charset that solved part of the issue was UTF-8 

I also found that if I create a signature.txt encoded in Unicode instead of UTF-8 and use "[...] file signature.txt html" GAM interpret all the characters correctly. It's a solution, but maybe not the best one?

Do you have any other charsets to suggest? Please see below the result of UTF-8 and the charsets I've tried. 

Thank you




Le vendredi 13 octobre 2017 12:05:06 UTC-4, Ross Scroggs a écrit :
Charles,

Please try: gam user charlesl...@caronetguay.ca signature file charleslaverdiere@caronetguay.ca.html charset latin1 html

Ross


Andy Poirier

unread,
Oct 13, 2017, 1:29:29 PM10/13/17
to google-ap...@googlegroups.com
Here is what I do for this, I don't know if it'll help but you can try

Create the signature how you want it in Gmail settings, 

'gam user username show signature > ~/Desktop/signature.html'

In the HTML file you can edit the variables that you'll be inserting

and then 

gam user user...@example.com signature file ~/Desktop/signature.html html

Andy Poirier

Sr. IT Engineer


W E D D I N G W I R E


301 231 9473

an...@weddingwire.com

websitefacebookinstagramlinkedin



--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

Ross Scroggs

unread,
Oct 13, 2017, 1:44:20 PM10/13/17
to google-ap...@googlegroups.com
Charles,

If saving it in Unicode and not specifying charset worked, then that is the correct solution.

Ross

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.

To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.



--

Charles Laverdière

unread,
Oct 13, 2017, 1:54:35 PM10/13/17
to GAM for G Suite

Thank you Andy, it would work but i'm using a VB program linked to a SQL database to dynamicly populate tags in my html template. This way I don't have to create a new signature every time :)

@Ross, I will do that then, I just need to find a way to convert all my html files into unicode text files all at once. Shouldn't be that hard. If you want to go deeper, I checked the actual HTML code after GAM inserted it into gmail and I found that it seems to be cause by an incomplete <head> tag. Maybe something strips incorectly the head tag? I'm fairly new in coding :) You can see it on the screenshot. 

Thanks all for your answers



Message has been deleted

Charles Laverdière

unread,
Oct 13, 2017, 2:10:32 PM10/13/17
to GAM for G Suite
I'm sorry, I meant ANSI not Unicode. I hope it will help someone sometime.


Le vendredi 13 octobre 2017 13:44:20 UTC-4, Ross Scroggs a écrit :
Charles,

Ross Scroggs

unread,
Oct 13, 2017, 2:48:58 PM10/13/17
to google-ap...@googlegroups.com
Charles,

gam <UserTypeEntity> signature <String>|(file <FileName> [charset <Charset>]) (replace <Tag> <String>)* [html] [name <String>] [replyto <EmailAddress>] [default] [treatasalias <Boolean>]


Maybe this will help. You can embed tags in your template and replace them on the command line.
For example, let's say you have a template HTML file named SigTemplate.html. In that file at the place where you want the given name to go, put {Nom}, for family name put {NomDeFamille}
gam user charleslaverdiere@caronetguay.ca signature file SigTemplate.html html replace Nom "Charles" replace NomDeFamille "Laverdiere"
On the command line don't include the {}. You can have multiple replace <Tag> <String> instances.
Make your VB script output a CSV file SigData.csv with these headers:
User,Nom,NomDeFamille

The CSV header names and tags do not have to be the same and you may have more tags.

gam csv SigData.csv charset xxx gam user ~User signature file SigTemplate.html html replace Nom ~Nom replace NomDeFamille ~NonDeFamille

Use charset xxx if required but if you save the data as UTF-8 you shouldn't need it.

You can test with your signature.

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.



--

Charles Laverdière

unread,
Oct 13, 2017, 4:03:04 PM10/13/17
to GAM for G Suite
If only I saw this possibility before, maybe I would have used this option already integrated in GAM! My bad...

At the moment, everything is working fine. I wrote a program in VB that read a template HTML file, overwrite it's tags with data from a SQL database, creates a new html file for each user (now encoded in ANSI) named us...@caronetguay.ca.html and dump the file into a folder.

Now i'm planning to invoke the GAM process into my "for each user in the database" loop and set the previously created us...@caronetguay.ca.html as the signature for each of my users. All that with only 1 click on a button! :) 

I'm learning but i'm pretty proud of what I built!

Thanks again for helping me solve this encoding problem. 

The solution was to change the encoding used in my VB program when it creates the user's html file.
Instead of 
My.Computer.FileSystem.WriteAllText("D:\signatures\" & DT_USERS(i).Email & ".html", strLectureValeur, False, System.Text.UTF8Encoding.UTF8)
I used
My.Computer.FileSystem.WriteAllText("D:\signatures\" & DT_USERS(i).Email & ".html", strLectureValeur, False, System.Text.UTF8Encoding.Default)
Wich somehow refer to ANSI

Ross Scroggs

unread,
Oct 13, 2017, 4:34:01 PM10/13/17
to google-ap...@googlegroups.com
Charles,

You can can some additional speed up by replacing your VB "for each user in the database" loop with a single gam csv command.
Have your VB script create a CSV file UserSigUpdates.csv with a single column of the users being updated.
User
...

gam csv UserSigUpdates.csv gam user ~User signature file ~~User~~.html html

To embed column data in an argument use ~~Column~~ in the argument; in this case we're adding .html to the user address.

Ross



--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.



--

Charles Laverdière

unread,
Oct 13, 2017, 5:19:53 PM10/13/17
to google-ap...@googlegroups.com
Thanks Ross!

I will try that. Have a nice weekend :)

Le 13 oct. 2017 4:34 PM, "Ross Scroggs" <ross.s...@gmail.com> a écrit :
Charles,

You can can some additional speed up by replacing your VB "for each user in the database" loop with a single gam csv command.
Have your VB script create a CSV file UserSigUpdates.csv with a single column of the users being updated.
User
...

gam csv UserSigUpdates.csv gam user ~User signature file ~~User~~.html html

To embed column data in an argument use ~~Column~~ in the argument; in this case we're adding .html to the user address.

Ross


On Fri, Oct 13, 2017 at 1:03 PM, Charles Laverdière <charleslaverdiere@caronetguay.ca> wrote:
If only I saw this possibility before, maybe I would have used this option already integrated in GAM! My bad...

At the moment, everything is working fine. I wrote a program in VB that read a template HTML file, overwrite it's tags with data from a SQL database, creates a new html file for each user (now encoded in ANSI) named us...@caronetguay.ca.html and dump the file into a folder.

Now i'm planning to invoke the GAM process into my "for each user in the database" loop and set the previously created us...@caronetguay.ca.html as the signature for each of my users. All that with only 1 click on a button! :) 

I'm learning but i'm pretty proud of what I built!

Thanks again for helping me solve this encoding problem. 

The solution was to change the encoding used in my VB program when it creates the user's html file.
Instead of 
My.Computer.FileSystem.WriteAllText("D:\signatures\" & DT_USERS(i).Email & ".html", strLectureValeur, False, System.Text.UTF8Encoding.UTF8)
I used
My.Computer.FileSystem.WriteAllText("D:\signatures\" & DT_USERS(i).Email & ".html", strLectureValeur, False, System.Text.UTF8Encoding.Default)
Wich somehow refer to ANSI

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.

To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.



--

--
You received this message because you are subscribed to a topic in the Google Groups "GAM for G Suite" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/CbqZmNCXOks/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-manager+unsub...@googlegroups.com.

To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

Bertrand Delcroix

unread,
Jun 26, 2020, 5:37:49 AM6/26/20
to GAM for G Suite
bonjour

Tout d'abord, je suis informaticien mais je ne connais pas du tout l'ensemble des html et javascript mais en sql ...
Et je travaille pour l'association radio présence et j'essaie de developper la signature électronique en une seule fois pour tous les personnels . C'est a dire que l'on pourrait copier et coller la procédure HTML avec le sql /javascript dans le GMAIL. 

Mon but est de trouver l'adresse mail du personnel  correspondant à celui du compte GMAIL et ensuite, on affiche la fiche personnelle comme nom/prenom et profession et n° poste + adresse postale du site.

Serait il possible de m'aider si vous connaissez la procédure etc ... svp ?

D'avance, merci pour votre retour.

Bien cordialement

Le vendredi 13 octobre 2017 17:27:05 UTC+2, Charles Laverdière a écrit :
Hello all 

I need help please!

I built HTML files wich contains HTML code for all of my user's signature. Everything is fine when i'm opening the file with chrome, but when GAM set the signature it adds unwanted characters in the final signature output. Here is a screenshot of what the result looks like. 


- You can see the added character just after the logo ()

- Every french canadian character is not recognized (Laverdière, Réseau, Beaupré, Québec)


I looked for a solution to this, and unfortunatly all the solutions I found did not work. Someone on this forum suggested to use the "charset" argument, but it does seem to be excluded from the latest GAM version.


Here is the exact GAM command i'm using: gam user charlesl...@caronetguay.ca signature file charleslaverdiere@caronetguay.ca.html html

Reply all
Reply to author
Forward
0 new messages