# Users - Gmail - Send As/Signature/Vacation - [API documentation](#api-documentation) - [Definitions](#definitions) - [Manage sendas](#manage-sendas) - [Display sendas](#display-sendas) - [Manage signature](#manage-signature) - [Display signature](#display-signature) - [Display users without a primary email address signature](#display-users-without-a-primary-email-address-signature) - [Manage vacation](#manage-vacation) - [Display vacation](#display-vacation) - [User attribute `replace ` processing](Tag-Replace) - [Standardize user signatures](#standardize-user-signatures) ## API documentation * https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs * https://developers.google.com/gmail/api/v1/reference/users/settings * https://support.google.com/a/answer/1710338 ## Definitions * [``](Collections-of-Users) * [Command data from Google Docs/Sheets/Storage](Command-Data-From-Google-Docs-Sheets-Storage) ``` = false|off|no|disabled|0 ::= true|on|yes|enabled|1 ::= (.)+ ::= @ ::= "(,)*" ::= | | | See: https://github.com/GAM-team/GAM/wiki/Collections-of-Users ::= ascii|mbcs|utf-8|utf-8-sig|utf-16| ::= ::= ::= ::= ::= (field:)|(schema:.)| ::= ::= ::= https://storage.cloud.google.com//| https://storage.googleapis.com//| gs:///| / ::= ||( ) ::= (sig|signature|htmlsig )| (file|htmlfile [charset ])| (gdoc|ghtml )| (gcsdoc|gcshtml ) ::= ()| (file|htmlfile [charset ])| (gdoc|ghtml )| (gcsdoc|gcshtml ) ::= (message|textmessage|htmlmessage )| (file|textfile|htmlfile [charset ])| (gdoc|ghtml )| (gcsdoc|gcshtml ) ``` ## Manage sendas ``` gam [create|add] sendas [name] [ (replace )*] [html []] [replyto ] [default] [treatasalias ] [smtpmsa.host smtpmsa.port 25|465|587 smtpmsa.username smtpmsa.password [smtpmsa.securitymode none|ssl|starttls]] gam update sendas [name ] [ (replace )*] [html []] [replyto ] [default] [treatasalias ] gam delete sendas ``` With `create|add`, the `` following `` and optionally `name`, is the display name of the sendas address. `` is the signature, there are four ways to specify it: * `sig|signature|htmlsig ` - Use `` as the signature * `file|htmlfile [charset ]` - Read the signature from `` * `gdoc|ghtml ` - Read the signature from `` * `gcsdoc|gcshtml ` - Read the signature from the Google Cloud Storage file `` The `default` option sets `` as the default sendas address for the user. For `treatasalias`, see: https://support.google.com/a/answer/1710338 You can allow users to send mail through an external SMTP server when configuring a sendas address hosted outside your email domains. You must enable this capability in Admin Console/Apps/Google Workspace/Gmail/Advanced settings/End User Access/Allow per-user outbound gateways. Example: Paul shall send emails from the marketing email address with the name Paul from Example" and replies shall go back to them. ``` gam user paul add sendas marketing@example.com "Paul from Example" replyto paul``` ## Display sendas ### Display the information as an indented list of keys and values. ``` gam info sendas [compact|format|html] gam show sendas [compact|format|html] [primary|default] [verifyonly] ``` These are the output formatting options: * `compact` - Escape carriage returns as \r and newlines as \n in original HTML; this format produces output that can be used as input to GAM * `format` - Strip HTML keywords leaving basic printable information * `html` - Show original HTML; this is the default option; the output is human readable but cannot be used as input to GAM By default, all sendas addresses are shown, use these options to limit the display: * `primary` - Display the primary email address * `default` - Display the default sendas address Use the `verifyonly` option to display `True` or `False` in the signature field based on whether the signature is non-blank. ### Display the information in CSV form. ``` gam print sendas [compact] [primary|default] [verifyonly] [todrive *] ``` These are the output formatting options: * `compact` - Strip carriage returns and newlines in original HTML; this makes these values easier to process in the CSV file and can be used as input to GAM. By default, all sendas addresses are shown, use these options to limit the display: * `primary` - Display the primary email address * `default` - Display the default sendas address Use the `verifyonly` option to display `True` or `False` in the signature field based on whether the signature is non-blank. ## Manage signature ``` gam signature|sig (replace )* [html []] [replyto ] [default] [treatasalias ] [name ] [primary] ``` `` is the signature, there are four ways to specify it: * `` - Use `` as the signature * `file|htmlfile [charset ]` - Read the signature from `` * `gdoc|ghtml ` - Read the signature from `` * `gcsdoc|gcshtml ` - Read the signature from the Google Cloud Storage file `` The `default` option sets `` as the default sendas address for the user. For `treatasalias`, see: https://support.google.com/a/answer/1710338 When `` specifies an alias, the `primary` option causes the primary email address signature rather than the alias signature to be set. `[name ]` sets the display name for non-primary sendas addresses, not the name of the signature, as that isn't possible via the API. If you have a current default signature, the API will update that, but if you delete it, it seems that the API will not over-write any of the other signatures, but instead add a new signature called `My signature`. If you rename that signature, the API will keep on updating that same signature, and not touch the other signatures. ## Display signature ### Display the information as an indented list of keys and values. ``` gam show signature|sig [compact|format|html] [primary|default] [verifyonly] ``` These are the output formatting options: * `compact` - Escape carriage returns as \r and newlines as \n in original HTML; this format produces output that can be used as input to GAM * `format` - Strip HTML keywords leaving basic printable information * `html` - Show original HTML; this is the default option; the output is human readable but cannot be used an input to GAM By default, the signature for `` is displayed, use these options to alter the display: * `primary` - Display the primary email address signature * `default` - Display the default sendas address signature Use the `verifyonly` option to display `True` or `False` in the signature field based on whether the signature is non-blank. ### Display the information in CSV form. ``` gam print signature [compact] [primary|default] [verifyonly] [todrive *] ``` These are the output formatting options: * `compact` - Strip carriage returns and newlines in original HTML; this makes these values easier to process in the CSV file and can be used as input to GAM. By default, the signature for `` is displayed, use these options to alter the display: * `primary` - Display the primary email address signature * `default` - Display the default sendas address signature Use the `verifyonly` option to display `True` or `False` in the signature field based on whether the signature is non-blank. ## Display users without a primary email address signature The command line is wrapped for readability. ``` gam config csv_output_row_filter "signature:boolean:false" csv_output_header_filter "User,displayName,signature" auto_batch_min 1 num_threads 10 redirect csv ./NoPrimarySignature.csv multiprocess all users print signature primary verifyonly ``` * `config csv_output_row_filter "signature:boolean:false"` - Output rows that indicate no signature * `csv_output_header_filter "User,displayName,signature"` - Output basic headers * `auto_batch_min 1 num_threads 10` - Turn on parallel processing * `redirect csv ./NoPrimarySignature.csv multiprocess` - Intelligently combine output from all processes * `all users` - Process all non-suspended users * `print signature primary verifyonly` - Display state of primary email address signature ## Manage vacation ``` gam vacation [] [subject ] [ (replace )*] [html []] [contactsonly []] [domainonly []] [start|startdate |Started] [end|enddate |NotSpecified] ``` The initial `` can be omitted to allow updates to other fields without affecting the current responder state. `` is the vacation message, there are four ways to specify it: * `message|textmessage|htmlmessage ` - Use `` as the vacation message * `file|htmlfile [charset ]` - Read the vacation message from `` * `gdoc|ghtml ` - Read the vacation message from `` * `gcsdoc|gcshtml ` - Read the vacation message from the Google Cloud Storage file `` It's highly recommended to set (overwrite) start and end date. Otherwise it may not work for users who used vacation messages previously and where the end date is already expired. Example: ```gam user@domain.com vacation ON subject "[Out of Office]" file autoreply.eml start 2000-01-01 end 2999-01-01``` ## Display vacation ``` gam show vacation [compact|format|html] [enabledonly] ``` Gam displays the information as an indented list of keys and values. These are the output formatting options: * `compact` - Escape carriage returns as \r and newlines as \n in original HTML; this format produces output that can be used as input to GAM * `format` - Strip HTML keywords leaving basic printable information * `html` - Show original HTML; this is the default option; the output is human readable but cannot be used an input to GAM * `enabledonly` - Do not display users with vacation autoreply disabled. ``` gam print vacation [compact] [enabledonly] [todrive *] ``` Gam displays the information in CSV form. * `compact` - Strip carriage returns and newlines in original HTML; this makes these values easier to process in the CSV file and can be used as input to GAM. * `enabledonly` - Do not display users with vacation autoreply disabled. ## Standardize user signatures You can standardize user signatures by creating a signature template and a CSV file with data for each user. You can create a signature template by defining the signature in the Gmail Settings GUI of a test user. You must use the default signature `My signature`. Use text like `{FirstName}` and `{Email}` in the locations where the actual values will go. Once you're created the template signature, do the following: ``` $ gam user testuser@domain.com show signature compact > SimpleSig.html $ more SimpleSig.html SendAs Address: IsPrimary: True Default: True Signature:
--
Name: {FirstName} {LastName}
Phone: {Phone}
Email: {Email}

Company Name
Company Address

\n ``` Edit SimpleSig.html and delete all text from `SendAs ` through `Signature: `. The result should be: ```
--
Name: {FirstName} {LastName}
Phone: {Phone}
Email: {Email}

Company Name
Company Address

\n ``` This is a sample Users.csv file. ``` email,first,last,phone bsmith@domain.com,Bob,Smith,510-555-1212 x 123 mjones@domain.com,Mary,Jones,510-555-1212 x 456 ``` This command will update the user's signatures. ``` gam csv Users.csv gam user "~email" signature htmlfile SimpleSig.html replace FirstName "~first" replace LastName "~last" replace Phone "~phone" replace Email "~email" ```