-
Notifications
You must be signed in to change notification settings - Fork 473
l ExamplesEmailSettings
- Signatures and Away Messages
- Labels and Filters
- IMAP, POP
- Send As
- Forwarding
- Delegates
- Managing S/MIME Certificates
- Hiding/Unhiding users from the domain contacts
- User Profile Photos
- Managing User Email
- Print/Show User Gmail Profile
- Managing User Display Language
gam user <username>|group <groupname>|ou <ouname>|all users [signature <signature text>] [file <signature file>] [replyto <EmailAddress>] (replace <Tag> <String>)*
sets a email signature for the given users' primary email address. Use quotes around the signature text if it contains spaces (which it almost certainly will). New lines can be specified with \n. HTML can also be used. An empty string like "" will disable the signature. Use the optional file
argument to specify a filename that contains the signature text. This is easier for long, complex signatures. Use the optional replyto
argument to specify a reply to address for use with this signature. The optional argument replace
can be used to insert values into the signature text. Every instance of {Tag
} in the signature will be replaced by String
. Instances of the form {RT}...{Tag
}...{/RT} will be eliminated if that Tag
was not specified or if Tag
was specified but the accompanying String
is empty. {RT} and {/RT} are eliminated from the signature.
This example sets all user's signatures to be:
Acme Inc
1321 Main Ave
http://www.acme.com
gam all users signature
"Acme Inc<br>1321 Main Ave<br>http://www.acme.com
This example reads the signature from a file:
gam user bob@example.com signature file bobs-sig.txt
This example reads the signature from an HTML file:
gam user sue@example.com signature file sues-html-sig.html html
gam
user <username> | group <groupname>| ou <ouname> | all users show signature [format]
Shows the email signature for the given users. By default, the raw HTML of the signature is shown, the optional argument format
causes the HTML to be interpreted.
This example shows all user's signature
gam all users show signature
gam
user <username> | group <groupname> | ou <ouname> | all users
vacation on|off subject <subject text> [message <message text>] | [file <message file>] [html]
startdate <YYYY-MM-DD> enddate <YYYY-MM-DD>
[contactsonly] [domainonly]
(replace <Tag> <String>)*
enable or disable a vacation/away message for the given users. subject <subject text>
will set the away message subject. message <message text>
will set the away message text. Use quotes around <subject text>
and <message text>
if they contain spaces (which they probably will). If file
is specified instead of message, the message will be read from the given text file. In <message text>
, \n will be replaced with a new line. The optional argument html
says to interpret the message text as HTML. Except for the simplest messages, you should specify html
even if your message doesn't contain HTML as Google does unexpected line wrapping when html
is not specified. The optional startdate
and enddate
arguments set a start and end date for the vacation message to be enabled. The optional argument contactsonly
will only send away messages to persons in the user's Contacts. The optional argument domainonly
will prevent vacation messages from going to users outside the Google Apps domain. The optional argument replace
can be used to insert values into the away message text. Every instance of {Tag
} in the message will be replaced by String
. Instances of the form {RT}...{Tag
}...{/RT} will be eliminated if that Tag
was not specified or if Tag
was specified but the accompanying String
is empty. {RT} and {/RT} are eliminated from the message.
This example sets the away message for the user
gam user epresley vacation on subject "Elvis has left the building"
message "I will be on Mars for the next 100 years. I'll get back to you when I return.\n\nElvis"
This example reads the message from a text file:
gam user bob@example.com vacation on subject "I am away" file bobs-away-message.txt
gam
user <username> | group <groupname> |ou <ouname> | all users show vacation [format]
Show the given user's vacation message and settings. By default, the plain text or raw HTML of the vacation message is shown, the optional argument format
causes the HTML to be interpreted.
This example shows the vacation settings for jsmith
gam user jsmith show vacation
gam user <username>|group <groupname>|ou <ouname>|all users label <label name>
create a Gmail Label for the given users. Use quotes around the label name if it contains spaces. Labels are described here.
This example creates a label called New Label for all users
gam all users label "New Label"
gam user <username>|group <groupname>|ou <ouname>|all users show labels [onlyuser] [showcounts]
Show the labels for the given users. If the optional argument onlyuser
is specified, default labels including inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv will not be shown. Label visibility will also be reported. If the optional argument showcounts
is specified, message and thread counts will be show for each label.
This example shows the labels for all members of the marketing group
gam group marketing show labels
gam user <username>|group <groupname>|ou <ouname>|all users delete label <label name>
delete the given label for the given users. Use quotes around the label name if it contains spaces. Labels are described here.
This example deletes a label called Old Label for all users
gam all users delete label "Old Label"
gam user <username>|group <groupname>|ou <ouname>|all users filter
from <email>|to <email>|subject <words>|haswords <words>|nowords <words>|musthaveattachment
label <label name>|markread|archive|star|forward <email address>|trash|neverspam|important|notimportant
Create a Filter for the given users. Filter must have one or more conditions (from, to, subject, haswords, nowords or musthaveattachment) and one or more actions (label, markread, archive, star, forward, trash, neverspam, important or notimportant). You do not need to create a label before creating a filter that labels messages, creating a filter that labels messages will automatically create the label. Filters are described here and Search operators here.
This example creates a filter for the user john that labels messages from dianne@gmail.com and archives them (thus they will only appear under the label)
gam user john filter from dianne@gmail.com label Dianne archive
This example creates a filter for the user john that marks messages from dianne@gmail.com as category:primary and stars them (hint: you can find all predefined Lable/Category types here)
gam user john filter from dianne@gmail.com label "CATEGORY_PERSONAL" star
This example creates a filter for the user john that labels messages from anyuser@anysubdomain.example.com and anyuser@example.com and marks messages to never send to spam (hint: -me
avoids Sent messages to show up in the INBOX)
gam user john filter from "-me AND .example.com OR example.com" label "thrusted" neverspam
gam user <username>|group <groupname>|ou <ouname>|all users info filters <FilterIDList>
Display details of a list of specific filters.
gam user <username>|group <groupname>|ou <ouname>|all users delete filters <FilterIDList>
Delete a list of filters of a user.
gam user <username>|group <groupname>|ou <ouname>|all users print filters [todrive]
Display or upload to Google Drive a CSV report of all of a users' filters. The optional todrive
parameter specifies that the results should be uploaded to Google Drive rather than being displayed on screen or piped to a CSV text file.
gam user <username>|group <groupname>|ou <ouname>|all users show filters
Display details of all of a users' filters.
gam user <username>|group <groupname>|ou <ouname>|all users imap on|off [noautoexpunge] [expungebehavior archive|deleteforever|trash] [maxfoldersize 0|1000|2000|5000|10000]<br>
turn IMAP on or off for given users. There are three options:
noautoexpunge
: If this value is not specified, Gmail will immediately expunge a message when it is marked as deleted in IMAP. When specified, Gmail will wait for an update from the client before expunging messages marked as deleted.
expungebehavior
: The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder. The acceptable values are: "archive": Archive messages marked as deleted; "deleteforever": Immediately and permanently delete messages marked as deleted. The expunged messages cannot be recovered; "trash": Move messages marked as deleted to the trash.
maxfoldersize
: An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit.
This example will turn IMAP on for all current users in the domain.
gam all users imap on
gam user <username>|group <groupname>|ou <ouname>|all users show imap
shows the given users' current IMAP settings.
This example shows all user's IMAP status.
gam all users show imap<br>
gam user <username>|group <groupname>|ou <ouname>|all users pop on|off [for allmail|newmail] [action keep|archive|delete|markread]<br>
turn POP3 on or off for given users, "for allmail" will expose all Inbox mail to the POP client while "for newmail" will expose only mail received after POP was enabled. POPped mail can be left alone (keep), archived (archive), deleted (delete) or marked read (markread). If the for and action arguments are not specified, all mail will be popped and kept in the Inbox.
This example will turn POP on for any users in the group students. All mail in the Inbox will be exposed to the POP client and POPped emails will be kept in the Inbox.
gam group students pop on
This example will turn POP on for Bob but only for new mail he receives. Mail will be archived after it is popped:
gam user bob@example.com pop on for newmail action archive
gam user <username>|group <groupname>|ou <ouname>|all users show pop
show the given users' POP settings.
This example shows the pop settings for the group students
gam group students show pop
gam user <username>|group <groupname>|ou <ouname>|all users sendas <EmailAddress> <Name> [signature <String>|(file <FileName>) [replyto <EmailAddress>] [default] [treatasalias <Boolean>] (replace <Tag> <String>)*
Add <EmailAddress>
as one of the given users' send as addresses (also called Custom From). <Name>
is the nice name users see with the email (Use quotes if <name>
includes spaces). Each send as address can have its own signature. See Setting a Signature. Optionally, default
specifies that this should be the address used for outgoing mail by default (user can choose which address mail is sent from when they compose). Also optional, replyto <EmailAddress>
specifies a Reply To address to be used when mail is sent out via this sendas. See here for a description of the treatasalias <Boolean>
argument. The optional argument replace
can be used to insert values into the signature text. Every instance of {Tag
} in the signature will be replaced by String
. Instances of the form {RT}...{Tag
}...{/RT} will be eliminated if that Tag
was not specified or if Tag
was specified but the accompanying String
is empty. {RT} and {/RT} are eliminated from the signature.
Warning: Google has recently taken steps to limit what email addresses forwards can be set to via the API (and thus via GAM). See this blog post for details about what domains you can set forwards to. Generally you are limited to forwarding to your primary domain, alias and secondary domains and subdomains of those.
This example adds mtodd as one of alincoln's send as addresses.
gam user alincoln sendas mtodd "First Lady" replyto mtodd signature "Mary"
gam user <username>|group <groupname>|ou <ouname>|all users update sendas <EmailAddress> [name <Name>] [signature <String>|(file <FileName> ) (replace <Tag> <String>)*] [replyto <EmailAddress>] [default] [treatasalias <Boolean>]
Update the characteristics of <EmailAddress>
as one of the given users' send as addresses. See above for a description of the arguments.
This example updates mtodd as one of alincoln's send as addresses.
gam user alincoln update sendas mtodd name "Abe's Wife"
gam user <username>|group <groupname>|ou <ouname>|all users delete sendas <EmailAddress>
Delete <EmailAddress>
as one of the given users' send as addresses.
This example deletes alincoln's send as address mtodd.
gam user alincoln delete sendas mtodd
gam user <username>|group <groupname>|ou <ouname>|all users info sendas <EmailAddress> [format]
Shows the status of <EmailAddress>
as one of the given users' send as addresses.
This example shows the status of alincoln's send as address mtodd.
gam user alincoln info sendas mtodd
gam user <username>|group <groupname>|ou <ouname>|all users print sendas [todrive]
Display or upload to Google Drive a CSV report of users' send as addresses. The optional todrive
parameter specifies that the results should be uploaded to Google Drive rather than being displayed on screen or piped to a CSV text file.
This example outputs all users send as addressess in a CSV format.
gam all users print sendas
gam user <username>|group <groupname>|ou <ouname>|all users show sendas [format]
Shows the given users' send as addresses.
This example shows alincoln's send as addresses.
gam user alincoln show sendas
gam user <username>|group <groupname>|ou <ouname>|all users add forwardingaddress <EmailAddress>
Add <EmailAddress>
as one of the given users' forwarding addresses.
Warning: Google has recently taken steps to limit what email addresses forwards can be set to via the API (and thus via GAM). See this blog post for details about what domains you can set forwards to. Generally you are limited to forwarding to your primary domain, alias and secondary domains and subdomains of those.
This example adds mtodd as one of alincoln's forwarding addresses.
gam user alincoln add forwardingaddress mtodd
gam user <username>|group <groupname>|ou <ouname>|all users delete forwardingaddress <EmailAddress>
Delete <EmailAddress>
as one of the given users' forwarding addresses.
This example deletes alincoln's forwarding address mtodd.
gam user alincoln delete forwardingaddress mtodd
gam user <username>|group <groupname>|ou <ouname>|all users info forwardingaddresses <EmailAddress>
Shows the status of <EmailAddress>
as one of the given users' forwarding addresses.
This example shows the status of alincoln's forwarding address mtodd.
gam user alincoln info forwardingaddress mtodd
gam user <username>|group <groupname>|ou <ouname>|all users print forwardingaddresses [todrive]
Display or upload to Google Drive a CSV report of users' forwarding addresses. The optional todrive
parameter specifies that the results should be uploaded to Google Drive rather than being displayed on screen or piped to a CSV text file.
This example outputs all users forwarding addressess in a CSV format.
gam all users print forwardingaddresses
gam user <username>|group <groupname>|ou <ouname>|all users show forwardingaddresses
Shows the given users' forwarding addresses.
This example shows alincoln's forwarding addresses.
gam user alincoln show forwardingaddresses
gam user <username>|group <groupname>|ou <ouname>|all users forward off
gam user <username>|group <groupname>|ou <ouname>|all users forward on <EmailAddress> keep|archive|delete|markread
Disable/enable and set an automatic email forward for the given users. If turning forwarding on, an <EmailAddress>
and an action (keep|archive|delete|markread
) are both required. The <EmailAddress>
you specify must already have been set up as a forwarding address. Actions specify what to do with messages that have been forwarded.
This example sets a forward for the user, messages will be deleted after they are forwarded so they will not show up in the user's account
gam user eclapton forward on eclapton@music.com delete
gam user <username>|group <groupname>|ou <ouname>|all users print forward [todrive]
Display or upload to Google Drive a CSV report of users' forward settings. The optional todrive
parameter specifies that the results should be uploaded to Google Drive rather than being displayed on screen or piped to a CSV text file.
This example outputs all users forwarding settings in a CSV format.
gam all users print forward
gam user <username>|group <groupname>|ou <ouname>|all users show forward
shows the given users' forwarding settings.
This example shows alincoln's forwarding settings.
gam user alincoln show forward
A delegate is someone who has been given access to someone else's email or contacts. The delegator is the one whose email and contacts are accessible by the delegate. Delegate and the delegators must be in the same domain, granting delegate access across multiple domains is currently not possible.
gam user <username>|group <groupname>|ou <ouname>|all users delegate to <delegate email>
gam user <username>|group <groupname>|ou <ouname>|all users add delegate <delegate email>
Gives email and contact access for the given users (the delegators) to the specified delegate account. Unlike when users request delegate access via Gmail settings, no email will be sent to the delegators for approval, the approval occurs immediately. The delegate and the delegator must be in the same domain, granting delegate access across multiple domains is currently not possible.
Both the Gmail delegator and the delegate:
- Must be active. A 500 error is returned if either user is suspended and disabled.
- Must not require a change of password on the next sign in. A 500 error is returned if either user has this flag enabled in the control panel, or, using the Provisioning API, the changePasswordAtNextLogin attribute is true.
You can confirm these settings using the gam info user command. Both "Account suspended" and "Must change password" should show false for both the delegate and the delegator.
This example gives jbezos access to the contacts and email of the sales account.
gam user sales delegate to jbezos@amazon.com
gam user <username>|group <groupname>|ou <ouname>|all users delete delegate <delegate email>
Deletes the delegate for the given users.
This example takes away deSecretary's access to deBoss's email and contacts.
gam user deBoss delete delegate deSecretary
gam user <username>|group <groupname>|ou <ouname>|all users print delegates [todrive]
Display or upload to Google Drive a CSV report of users' delegates. The optional todrive
parameter specifies that the results should be uploaded to Google Drive rather than being displayed on screen or piped to a CSV text file.
Prints the delegates that have access to the given user accounts.
This example prints delegates across the entire domain.
gam all users print delegates
gam user <username>|group <groupname>|ou <ouname>|all users show delegates [csv]
Shows the delegates that have access to the given user accounts. Optional argument csv prints out CSV style output instead of human readable.
This example shows delegates for users in the technology group.
gam group technology show delegates
gam user <username>|group <groupname>|ou <ouname>|all users add contactdelegate <delegate email>
Delegates given user(s) contacts to the given delegate user.
This examples gives D. Landingham access to manage J. Bartlet's contacts.
gam user jbartlet@acme.com add contactdelegate dlandingham@acme.com
gam user <username>|group <groupname>|ou <ouname>|all users delete contactdelegate <delegate email>
Removes a delegate user's access to a given user's contacts.
This example removes C. Young's delegate access to J. Bartlet's contacts.
gam user jbartlet@acme.com delete contactdelegate cyoung@acme.com
gam user <username>|group <groupname>|ou <ouname>|all users print contactdelegates [todrive]
Prints the contact delegates of a given user. The optional todrive argument causes the output to generate a Google Sheet rather than printing to the console.
This example prints all contact delegates for J. Bartlet to a Google Sheet.
gam user jbartlet@acme.com print contactdelegates todrive
gam user <username>|group <groupname>|ou <ouname>|all users show contactdelegates
Shows the contact delegates of a given user in human-friendly output format.
This example shows all contact delegates for J. Bartlet.
gam user jbartlet@acme.com show contactdelegates
gam user <email> add smime <file <filename>> <password <password>> [default] [sendas <email>]
Uploads an S/MIME certificate for the user. The file argument specifies the local file which contains the S/MIME Certificate to be uploaded. The password argument specifies the password used to encrypt the S/MIME certificate. The optional argument default specifies that if user has multiple certificates for this sendas, this one should be the default. The optional argument sendas specifies the sendas email address that the S/MIME certificate should be used with. If sendas is not specified, the user's primary address is assumed.
This example uploads the file jim.pfx for Jim and marks it as default.
gam user jim@acme.com add smime file jim.pfx password p@ssw3rd default
gam user <email> update smime [id <id>] [sendas <email>] <default>
Updates a S/MIME certificate for a user. Currently the only update operation is to mark the certificate as the default. The id argument specifies the id of the S/MIME certificate to update. If ID is not specified then all existing certificates will be listed. The sendas argument specifies the sendas address which owns the certificate to be updated. If sendas is not specified, the user's primary address is assumed. The default argument updates the selected certificate to be the default. Currently default is required since it's the only update operation.
This example sets a certificate to be the default for John's primary address.
gam user john@acme.com update smime id 84833830 default
gam user <email> delete smime <id <id>> [sendas <email>]
Deletes a S/MIME certificate for a user. The id argument specfies which S/MIME certificate should be deleted. The optional sendas argument specifies the sendas address which the certificate is associated with. If sendas is not specified then the user's primary address is used.
This example delete's the user's certificate.
gam user john@acme.com delete smime id 34394348349
gam user <email> show|print smime primaryonly todrive
Show or print the S/MIME certificates of the specified user(s). Show displays the certificates on the screen while print outputs CSV format. The optional argument primaryonly skips looking up additional sendas addresses for user and only pulls certificates associated with the user's primary address. The optional argument todrive specifies that printed output should be uploaded to a Google Drive Spreadsheet instead of displaying the CSV to the screen.
This example creates a spreadsheet with all user primary certificates.
gam all users print smime primaryonly todrive
Individual user profiles can be hidden/unhidden from the domain contacts list (sometimes called the Global Address List or GAL).
gam user <username>|group <groupname>|ou <ouname>|all users profile shared|unshared
this example hides all users in the asked-to-be-hidden Google group from email address autocomplete and contact searches.
gam group asked-to-be-hidden profile unshared
gam user <username>|group <groupname>|ou <ouname>|all users show profile
this example shows the status of all user profiles in the domain.
gam all users show profile
gam user <username>|group <groupname>|ou <ouname>|all users update photo <photo filename>
Create or replace the user's photo with the one specified by filename. File should be jpg format. You can use #user# as part of the filename and it will be replaced with the user's full email address.
this example replaces Michael Jones' photo with the one from the employee photo directory
gam user michael.jones@acme.com update photo h:\employee-photos\mjones.jpg
this example replaces all user's photos with ones stored in c:\photos<user email>.jpg
gam all users update photo c:\photos\#user#.jpg
gam user <username>|group <groupname>|ou <ouname>|all users get photo [drivedir|(targetfolder <FilePath>)] [noshow]
Gets the users' current photo and saves it to a file named username-domain.jpg in the GAM path. If drivedir
is specified, the files will be saved in the folder referenced by the environment variable GAMDRIVEDIR. If targetfolder <FilePath>
is specified, the files will be saved in FilePath. The noshow
argument prevents to photo data from being displayed to stdout.
This example retrieves photos for all users in Google Apps and saves them to files in the C:\photos directory.
gam all users get photo targetfolder "C:\photos"
gam user <username>|group <groupname>|ou <ouname>|all users delete photo
Deletes the given users' profile photo returning it to blank.
This example will delete the profile photo for all members of the group named abused-the-system
gam group abused-the-system delete photo
gam user <username>|group <groupname>|ou <ouname>|all users modify messages|threads query <gmail search> [doit] [maxtomodify <number>] [addlabel <label>] [removelabel <label>]
Modify user Gmail messages or threads. If you specify messages, the search will be done against individual messages and only individual messages that match the query will be modified. If you specify threads then all messages in all threads that match the query will be modified. The addlabel argument specifies labels that should be added to matching messages/threads. The removelabel argument specifies labels that should be added to matching messages/threads. The query parameter is required and uses Gmail search syntax. See the Advanced Gmail Search help article for some tips on complex searches.
By default, GAM will not modify any messages/threads for users. The doit parameter is needed to tell GAM to actually perform the modify operation.
The maxtomodify paramater (default: 1) defines how many matching messages/threads per user that may be modified. If more than this number of message matches the search query, GAM will refuse to modify ANY messages for that user.
This example moves all matching messages to the Spam folder.
gam user joe@acme.com modify messages query 'subject:"buy viagra"' addlabel SPAM removelabel INBOX doit maxtomodify 10
This example marks all messages from president@acme.com as Important and Starred.
gam all users modify messages query from:president@acme.com addlabel IMPORTANT addlabel STARRED doit maxtomodify 500
gam user <username>|group <groupname>|ou <ouname>|all users delete|trash|untrash messages|threads query <gmail search> [doit] [maxtodelete|maxtotrash|maxtountrash <number>]
Delete or move to trash messages or threads for a user or group of users. If you specify messages, the search will be done against individual messages and only individual messages that match the query will be deleted/trashed/undeleted. If you specify threads then all messages in all threads that match the query will be deleted/trashed/undeleted. The query parameter is required and uses Gmail search syntax. See the Advanced Gmail Search help article for some tips on complex searches.
By default, GAM will not delete/trash/untrash any messages for users, it only shows what messages will be impacted. The doit parameter is needed to tell GAM to actually perform the delete/trash/untrash operation.
The maxtodelete/maxtotrash/maxtountrash paramater (default: 1) defines how many matching messages/threads per user that may be affected. If more than this number of message matches the search query, GAM will refuse to modify ANY messages for that user.
This example gets a count of how many messages a user has with PDF attachments but doesn't actually do anything to them.
gam user joe@acme.org delete messages query filename:pdf
This example will delete the message that has this exact RFC822 Message ID header for all users. Only one message at most will be deleted for all users (they should have only one copy). This example is useful if an email is sent to a large number of people and you wish to remove it from their mailbox quickly.
gam all users delete messages query rfc822msgid:CAGoYzwvzepSfbHB8mBoOx4VqsiotTmRjvBSFjz8NMg2VXeHTrA@mail.gmail.com doit
This example will trash the thread that has a message from internal.leaker@gmail.com. This means that if users have replied to the message or forwarded it, those messages should also be deleted from the user mailbox.
gam all users delete threads query from:internal.leaker@gmail.com maxtodelete 10 doit
This example will trash all messages older than 7 years for members of the group. BE CAREFUL! There is no undo button. This command could be run on a regular basis (once a day or so) in order to ensure messages older than 7 years are trashed for the user.
gam group purge7@acme.org trash messages query older_than:7y doit maxtodelete 999999999
gam user <username>|group <groupname>|ou <ouname>|all users sendemail [message <message>] [file <file>] [subject <subject] [recipient <recipient>]
Sends an email as the given user. The optional argument message specifies the text to use for the email message including headers and body. The optional argument file reads the message including headers and body from a local file. An easy way to create a rich email message is to send it to yourself in Gmail UI and then Download the original to a file. The optional arguments subject and recipient set the message subject / recipient respectively and will override the headers set in message or file.
This example sends a quick message to the user and from the user
gam user test@example.com sendemail subject "from me, to me"
This example sends a message from the user to an external address
gam user test@example.com sendemail file c:\gam\test.eml recipient thedude@gmail.com
gam user <username>|group <groupname>|ou <ouname>|all users insertemail|importemail [message <message>] [file <file>] [subject <subject] [recipient <recipient>] [labels <labels,>]
Drops an email into the given users mailbox. Note that unlike sendemail, these commands will always put the email directly into the user's mailbox, no matter who the recipient is set to. insertemail uses the INSERT API method and is fastest though messages will not be de-duplicated or threaded in the Gmail mailbox. importemail uses the IMPORT API method which is slower but offers more processing options during delivery. By default, messages dropped in a user mailbox receive no labels which means they are archived and marked as read. To best grab a user's attention for reading the recommendation is to set labels like INBOX,UNREAD,IMPORTANT,STARRED. The optional argument message specified the message including headers and body. The optional argument file reads the message including headers and body from a local file. The optional arguments subject and recipient set the message subject and recipients overriding message and file. The optional argument labels specifies a comma separated list of labels to apply to the message.
Dropped messages do not get processed by user Gmail filters.
This example is the fastest way to get an email in front of a LOT of users quickly with a custom message per-user.
gam print users givenname | gam csv - gam user ~primaryEmail insertemail subject "ALERT: ~~givenName~~ donuts in the break room" labels INBOX,UNREAD,IMPORTANT,STARRED
gam user <username>|group <groupname>|ou <ouname>|all users draftemail [message <message>] [file <file>] [subject <subject] [recipient <recipient>]
Places a draft email in the given user's mailbox. The optional argument message specifies the email message including headers and body. The optional argument file reads the message from a local file. The optional argument subject sets the message subject overriding message/file. The optional argument recipient sets the message recipient overriding message/file.
This example creates a draft message for a user.
gam user me@example.com draftemail subject "TPS Report" message "This is my TPS report" recipient boss@example.com
gam user <username>|group <groupname>|ou <ouname>|all users print gmailprofile [todrive]
Display or upload to Google Drive a CSV report of user Gmail profile data. The optional todrive
parameter specifies that the results should be uploaded to Google Drive rather than being displayed on screen or piped to a CSV text file.
gam user <username>|group <groupname>|ou <ouname>|all users print gmailprofile
gam user <username>|group <groupname>|ou <ouname>|all users language <language code>
set the display language used for the user. A full list of language codes can be found here..
This example sets the user's language to UK English
gam user jlennon language en-GB
gam user <username>|group <groupname>|ou <ouname>|all users show language
get the display language currently set for the user.
This example gets the current language of the user.
gam user jlennon show language
Need more help? Ask on the GAM Discussion Group
Update History
Installation
- How to Install GAM7
- How to Upgrade GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Verifying a GAM7 Build is Legitimate and Official
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with a YubiKey
- GAM with minimal GCP rights
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- Scripts
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Chrome Auto Update Expiration Counts
- Chrome Browser Cloud Management
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Cloud Channel
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts - Global Address List
- Email Audit Monitor
- Find File Owner
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Users
- Unmanaged Accounts
- Users - Signout and Turn off 2-Step Verification
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Classroom - Profile
- Users - Deprovision
- Users - Contacts
- Users - Contacts - Delegates
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Group Membership
- Users - Keep
- Users - Looker Studio
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Photo
- Users - Profile Sharing
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tasks
- Users - Tokens
- Users - YouTube
GAM Tutorials
- Account Auditing
- Calendar Settings
- Chat Bot commands
- Chrome Browser Management
- Chrome Policy Settings
- Context Aware Access levels
- Data Transfers
- Domain Verification
- Google Drive Management
- Group Settings
- Inbound SSO Settings
- Managing Admins
- Managing Classroom
- Managing Custom User Schemas
- Managing Devices
- Managing Organizations
- Managing Product Licenses
- Managing Users, Groups, Aliases, Domains, Mobile and Chrome Devices, and Resource Calendars
- OAuth Authentication Related Commands
- Print Users, Groups, Aliases, Mobile and Chrome OS devices, OUs, Licenses and Reports
- Printers
- Unmanaged Users and Invitations
- User Email Settings
- User Security Settings