Skip to content

Latest commit

 

History

History
542 lines (473 loc) · 24.4 KB

ExamplesEmailSettings.md

File metadata and controls

542 lines (473 loc) · 24.4 KB

General Settings

Set User Language

Syntax

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. Note that language changes can take several hours to appear in the user's interface and may require the user to log out and log back in.

Example

This example sets the user's language to UK English

gam user jlennon language en-GB

Set Messages Per Page

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users pagesize 25|50|100

determine how many messages a user will see on a web page when viewing their Inbox or other labels.

Example

This example sets the page size to 50 for the user

gam user jhendrix pagesize 50

Enable/Disable Keyboard Shortcuts

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users shortcuts on|off

enable/disable keyboard shortcuts for the given users. List of shortcuts can be found here.

Example

This example turns keyboard shortcuts on for all users

gam all users shortcuts on

Enable/Disable Personal Indicator Arrows

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users arrows on|off

enable/disable personal indicator arrows for the given users. Personal indicator arrows are described here.

Example

This example turns personal indicator arrows off for the user

gam user jamesdean arrows off

Enable/Disable Email Snippets

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users snippets on|off

enable/disable message snippets in Inbox and other message lists.

Example

This example turns snippets off for the group newbies

gam group newbies snippets off

UTF-8 (Unicode) for outgoing mail

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users utf on|off

turn UTF-8 (Unicode) encoding of outgoing mail on or off.

Example

This example sets UTF-8 outgoing mail encoding on for members of the faculty group

gam group faculty utf on

Enable/Disable Webclips

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users webclips on|off

enable or disable webclips for the given users. Webclips are described here.

Example

This example disables webclips for all users

gam all users webclips off

Signatures and Away Messages

Setting a Signature

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users [signature <signature text>] [file <signature file>]

sets a email signature for the given users. 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.

Example

This example sets all user's signatures to be:

Acme Inc
1321 Main Ave<br>
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 [email protected] signature file bobs-html-sig.txt

Retrieving a Signature

Syntax

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.

Example

This example shows all user's signature

gam all users show signature

Enabling/Disabling and Setting a Vacation (Away) Message

Syntax

gam
 user <username> | group <groupname> | ou <ouname> | all users
 vacation on|off subject <subject text>
 [message <message text>]
 [file <message file>]
 startdate <YYYY-MM-DD> enddate <YYYY-MM-DD>
 [contactsonly] [domainonly]

enable or disable a vacation/away message for the given users. subject will be the away message subject. message will be the message text. Use quotes around subject 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 the message text, \n will be replaced with a new line. 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.

Example

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 [email protected] vacation on subject "I am away" file bobs-away-message.txt

Retrieving Vacation Settings

Syntax

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.

Example

This example shows the vacation settings for jsmith

gam user jsmith show vacation

Labels and Filters

Create a Label

Syntax

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.

Example

This example creates a label called New Label for all users
gam all users label "New Label"

Retrieving User's Labels

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users show labels
show the labels for the given users. Default labels including inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv will not be shown. Label visibility and number of unread messages in label will also be reported.

Example

This example shows the labels for all members of the marketing group
gam group marketing show labels

Delete a Label

Syntax

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.

Example

This example deletes a label called Old Label for all users
gam all users delete label "Old Label"

Create a Filter

Syntax

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
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 or neverspam). 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.

Warning: GAM cannot delete filters because Google has not provided a method for filter deletion in their APIs. Before creating filters for some or all users in your domain, please make sure you absolutely need/want them. The only way to get rid of them once created is to have each user manually delete them.

Example

This example creates a filter for the user john that labels message from [email protected] and archives them (thus they will only appear under the label)

gam user john filter from [email protected] label Dianne archive

Send As, IMAP, POP and Forwarding

Setting Send As (Custom From)

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users sendas <email address> <name> [default] [replyto <email address>]
allow the given users to send mail as another email address (also called Custom From). name is the nice name users see with the email (Use quotes if name includes spaces). 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 specifies a Reply To address to be used when mail is sent out via this sendas.

Note: the email address must be under the direct control of your Google Apps account, the domain must be your Google Apps primary domain, a secondary domain or a domain alias.

Example

This example will allow the user fjones to send mail as [email protected] by default (it is assumed to [email protected] is already setup as a user, group or nickname in your domain)
gam user fjones sendas [email protected] "Fred Jones" default

Retrieving Send As (Custom From)

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users show sendas
show the given users Send As / Custom From addresses.

Example

This example shows the send as settings for gwashington
gam user gwashington show sendas

Setting IMAP Settings

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users imap on|off
turn IMAP on or off for given users.

Example

This example will turn IMAP on for all current users in the domain.
gam all users imap on

Retrieving IMAP Settings

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users show imap
shows the given users' current IMAP settings.

Example

This example shows all user's IMAP status.
gam all users show imap

Setting POP Settings

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users pop on|off [for allmail|newmail] [action keep|archive|delete]
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) or deleted (delete). If the for and action arguments are not specified, all mail will be popped and kept in the Inbox.

Example

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 [email protected] pop on for newmail action archive

Retrieving POP Settings

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users show pop
show the given users' POP settings.

Example

This example shows the pop settings for the group students
gam group students show pop

Setting a Forward

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users forward on|off [email address] [keep|archive|delete]
enable/disable and set an automatic email forward for the given users. If turning forwarding on, an email address and action are both required. Actions (keep, archive and delete) specifies what to do with messages that have been forwarded.

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.

Example

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 [email protected] delete

Retrieving Forward Settings

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users show forward
shows the given users' forwarding settings.

Example

This example shows alincoln's forwarding settings.
gam user alincoln show forward

Delegates

A delegate is someone who has been given access to someone else's email and 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.

Creating a delegate

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users delegate to <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.

Example

This example gives jbezos access to the contacts and email of the sales account.
gam user sales delegate to [email protected]

Retrieving delegates

Syntax

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.

Example

This example shows delegates across the entire domain.
gam all users show delegates

Deleting a delegate

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users delete delegate <delegate email>
deletes the delegate for the given users.

Example

this example takes away deSecretary's access to deBoss's email and contacts.

gam user deBoss delete delegate deSecretary

Hiding/Unhiding users from the domain contacts

Individual user profiles can be hidden/unhidden from the domain contacts list (sometimes called the Global Address List or GAL).

Changing a users profile to hidden/unhidden

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users profile shared|unshared
Share a user's profile (contact) information with other users in the domain. If a user's profile is shared, they'll show up in autocomplete and contact searches for other users. If a user is unshared, others will not be able to discover the user's address and detailed contact info.

Example

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

Showing users profile hidden/unhidden status

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users show profile
Show the current sharing status of the users' profile.

Example

this example shows the status of all user profiles in the domain.

gam all users show profile

User Profile Photos

Support for user profile photo management has been added to GAM 2.3. Note that if you get errors about Authsub token invalid, you should delete the existing oauth.txt file and regenerate the OAuth authentication using GAM 2.3 so that the full Contacts API scope is included.

Updating Profile Photos

Syntax

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.


Example

this example replaces Michael Jones' photo with the one from the employee photo directory

gam user [email protected] 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

Getting Profile Photos

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users get photo
Gets the users' current photo and saves it to a file named username-domain.jpg in the GAM path. Note that if you get errors about Authsub token invalid, you should delete the existing oauth.txt file and regenerate the OAuth authentication using GAM 2.3 so that the full Contacts API scope is included.


Example

This example retrieves photos for all users in Google Apps and saves them to files.

gam all users get photo

Deleting Profile Photos

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users delete photo
Deletes the given users' profile photo returning it to blank. Note that if you get errors about Authsub token invalid, you should delete the existing oauth.txt file and regenerate the OAuth authentication using GAM 2.3 so that the full Contacts API scope is included.

Example

This example will delete the profile photo for all members of the group named abused-the-system

gam group abused-the-system delete photo
----

Managing User Email

Deleting Or Trashing User Email

Syntax

gam user <username>|group <groupname>|ou <ouname>|all users delete|trash messages query <gmail search> [doit] [max_to_delete <number>]

Delete or move to trash messages for a user or group of users. 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 any messages for users, it only shows what messages will be deleted. The doit parameter is needed to tell GAM to actually perform the delete/trash operation. By default, GAM will only delete one matching message per a user. If more than one message matches the search query, GAM will refuse to delete ANY messages. The max_to_delete parameter sets the maximum number of messages that GAM should delete per-user. If the search matches more messages than max_to_delete, NO messages will be deleted for that user.

Examples

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 [email protected] 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 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 [email protected] trash messages query older_than:7y doit max_to_delete 999999999