Best way to "pretty format" mobile numbers in HTML email signatures when using replace fields from directory data

147 views
Skip to first unread message

Angelo Giuffrida

unread,
Mar 28, 2025, 2:08:09 AMMar 28
to google-ap...@googlegroups.com
Hi all,

Happy Friday!

This was previously never a problem because within our GWS Directory we stored mobile numbers with "pretty format" spaces in them (eg: stored as "+61 421 123 456") so using replace mobile field:phone.value.type.mobile in the GAM command to replace the {{mobile}} merge field would yield us a "pretty format" looking signature, however, since updating our directory structure we no longer store them with spaces - meaning we need to find another way to fix this.

Now when we create the signatures from the HTML file they look like this (with no pretty number formatting):

image.png 

This is a snippet of the HTML:

            <p style="font-family: arial, helvetica, sans-serif; font-size: 13px; line-height: 1.5; margin: 0 0 3px;">
                <span style="color: #eb312e;">{fullname}</span><br>
                <span style="color: #333333;"><strong>{jobtitle}</strong></span>
            </p>
            <p style="font-family: arial, helvetica, sans-serif; font-size: 13px; line-height: 1.5; margin: 0;">
                <span style="color: #333333;"><span style="color: #eb312e;">m:</span>&nbsp;{mobile}</span>
            </p>
        </td>
    </tr>



Is there anyway to apply pretty-formatting to the {{mobile}} field? I see the GAM tag replace documentation has a reference to regex subfunctions but I can't work out a way to get it to work ("(\+\d{2})(\d{3})(\d{3})(\d{3})" "\1 \2 \3 \4").

Any advice on this?

Cheers, Angelo.

Ross Scroggs

unread,
Mar 28, 2025, 10:28:42 AMMar 28
to google-ap...@googlegroups.com
What does this show: gam info user x...@domain.com fields phone

Ross
----
Ross Scroggs



On Mar 27, 2025, at 11:07 PM, 'Angelo Giuffrida' via GAM for Google Workspace <google-ap...@googlegroups.com> wrote:

Hi all,

Happy Friday!

This was previously never a problem because within our GWS Directory we stored mobile numbers with "pretty format" spaces in them (eg: stored as "+61 421 123 456") so using replace mobile field:phone.value.type.mobile in the GAM command to replace the {{mobile}} merge field would yield us a "pretty format" looking signature, however, since updating our directory structure we no longer store them with spaces - meaning we need to find another way to fix this.

Now when we create the signatures from the HTML file they look like this (with no pretty number formatting):

<image.png> 

This is a snippet of the HTML:

            <p style="font-family: arial, helvetica, sans-serif; font-size: 13px; line-height: 1.5; margin: 0 0 3px;">
                <span style="color: #eb312e;">{fullname}</span><br>
                <span style="color: #333333;"><strong>{jobtitle}</strong></span>
            </p>
            <p style="font-family: arial, helvetica, sans-serif; font-size: 13px; line-height: 1.5; margin: 0;">
                <span style="color: #333333;"><span style="color: #eb312e;">m:</span>&nbsp;{mobile}</span>
            </p>
        </td>
    </tr>



Is there anyway to apply pretty-formatting to the {{mobile}} field? I see the GAM tag replace documentation has a reference to regex subfunctions but I can't work out a way to get it to work ("(\+\d{2})(\d{3})(\d{3})(\d{3})" "\1 \2 \3 \4").

Any advice on this?

Cheers, Angelo.


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/CAKZU4F2-kdjOAyf_8NOKnTFmQEWbWnoGiyqO%2B5v%3D%3DZ6CzhETXw%40mail.gmail.com.

Ross Scroggs

unread,
Mar 28, 2025, 10:32:58 AMMar 28
to google-ap...@googlegroups.com
I reread you message and now see the replace tag reference, I'll work on that and get back to you.

Ross
----
Ross Scroggs


Ross Scroggs

unread,
Mar 28, 2025, 3:53:54 PMMar 28
to google-ap...@googlegroups.com
You have a correct regex, but the is no way to apply it in the current code. A fairly sime Python script could be used to pretty format the numbers
in a CSV file and then tose coulbe be used.

Ross
----
Ross Scroggs


Angelo Giuffrida

unread,
Mar 30, 2025, 6:43:01 PMMar 30
to GAM for Google Workspace
Thanks Ross. I basically wrote that functionality over the weekend - but was still interested in if it's something that's ever been suggested. Appreciate the response though, thank you!

Ross Scroggs

unread,
Mar 30, 2025, 10:51:48 PMMar 30
to google-ap...@googlegroups.com
It's an interesting thought, I'll look info it.

Ross
----
Ross Scroggs


Angelo Giuffrida

unread,
Mar 30, 2025, 11:24:12 PMMar 30
to google-ap...@googlegroups.com
Legend, really appreciate it!

You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/YUam8unCGSU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/5DDA9CDC-1188-473E-B366-951CE29347DA%40gmail.com.

Ross Scroggs

unread,
Mar 30, 2025, 11:48:08 PMMar 30
to google-ap...@googlegroups.com
Are yiu available to Meet/Zoom right now? If, so send a private invitation.

Ross


----
Ross Scroggs



Angelo Giuffrida

unread,
Mar 30, 2025, 11:50:08 PMMar 30
to google-ap...@googlegroups.com
Sure, sent to you privately.
Nexigen Digital logo

Angelo Giuffrida
Co-founder & Co-CEO

m: +61 421 221 585



Ross Scroggs

unread,
Mar 31, 2025, 5:35:00 PMMar 31
to google-ap...@googlegroups.com

Angelo Giuffrida

unread,
Mar 31, 2025, 8:40:33 PMMar 31
to google-ap...@googlegroups.com
Love your work Ross, so quick and prompt! I can't see anything on the GAM documentation but did you have a buymeacoffee.com link or anything?

Ross Scroggs

unread,
Mar 31, 2025, 9:08:41 PMMar 31
to google-ap...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages