My favorites | English | Sign in

Email Settings API Developer's Guide

Contents

Setup

Manage Labels

Manage Filters

Manage Send-as Alias

Manage Web Clips

Manage Forwarding

Manage POP Settings

Manage IMAP Settings

Manage Vacation-Responder

Manage Signatures

Manage Language Settings

Manage Delegation Settings New!

Manage General Settings

Errors

Email Settings API Overview

Google Apps allows Google administrators to offer their users co-branded versions of a variety of personalized Google applications, such as Google mail.

This document describes the Email Settings API which enables Google partners to programmatically manipulate most user-level Google Mail settings.

API Operations

The Email Settings API supports the following operations:

  • The creation of the following entities for a user's account:
    • Labels
    • Filters
    • Send-as Aliases
    • Delegate Gmail access
  • Updating the following settings for a user's account:
    • Web clip settings
    • Forwarding settings
    • POP settings
    • IMAP settings
    • Vacation-Responder settings
    • Signature
    • Language settings
    • Many "General" settings such as Maximum Page Size, Shortcuts, Arrow Usage, Snippets, and Unicode activation
  • Retrieving the following settings for a user's account
    • Label settings
    • Send-as alias settings
    • Forwarding settings
    • POP settings
    • IMAP settings
    • Vacation-Responder settings
    • Signature
    • Gmail delegate settings
  • Deleting the following setting for a user's account
    • Delegate Gmail access

To use the Email Settings API, you need to send an HTTP request to a specific URL that represents a particular user's setting. The request will be one of three types—either a POST request that performs a create operation, for creating new labels, filters, or send-as aliases—or a PUT request that performs an update operation, for changing any of the updatable settings listed above—or a GET request that retrieves all the settings for labels, forwarding, and many others as listed above. Only the Gmail delegation Delete operation is currently supported.

The body of the PUT or the POST requests will contain XML that describes either the entity to be created, or the new values that the settings should take. A GET request does not have a body of additional XML elements. Google will verify that all requests contain valid XML, include all required data fields, and meet the authentication requirements given below.

API Authentication

All of your API requests must be sent over HTTPS. Each API request that you send needs to contain an authentication token, which Google will use to authorize access to the operation specified in the API request.

If your client is a standalone single-user "installed" client (such as a desktop application), then you should use the ClientLogin Interface system; if your client is a multi-user web application client, then you should use the 3-legged OAuth. Both of these methods involve interacting with an authentication service. The authentication service returns an authentication token that your client can then send to the Email Settings API service along with every subsequent request on behalf of that user.

For clients using ClientLogin and have been enrolled in two-step verification, use your two-step verification access code for the Passwd query parameter.

For more information about authentication with Google Data APIs in general, see the authentication documentation.

Most of the examples in subsequent sections of this document assume you are providing the appropriate authentication.

The ClientLogin Interface provides additional information about programmatically logging users into their accounts.

Back to top

ClientLogin username/password authentication

To obtain an authentication token, submit an HTTP POST request to the following URL:

https://www.google.com/accounts/ClientLogin

The following guidelines apply to the request:

  • The POST body needs to include a string in the following format:

    &Email=<email_address>&Passwd=<password>&accountType=HOSTED&service=apps

    You will need to make the following changes to this string:

    1. Replace the string <email_address> with the email address for your admin account.

    2. Replace the string <password> with the password for that account or the access code if the account is enrolled in two-step verification.

  • The email address and password values must be URL-encoded. For example, the URL-encoded form of the email address apps.test.account@example.com is apps%2Etest%2Eaccount%40example%2Ecom.

  • The POST request must specify the value application/x-www-form-urlencoded for the Content-Type header.

Google will return a response containing your authentication token in response to your POST request. The authentication token will be the Auth value on that page, and you need to extract the token from the page. When you submit an API request, you must set the Content-type and Authorization headers as shown in the example below.

  Content-type: application/atom+xml
Authorization: GoogleLogin auth=your-authentication-token

Note: Authentication tokens expire after 24 hours. As such, you will need to submit a request to the above URL at least once every 24 hours. We recommend that you keep the token in memory rather than writing it to a file.

OAuth for web applications

Email Settings API also supports 3-legged OAuth scheme for allowing web applications to manage email settings for user mail accounts. The OAuth guide provides more information on how to obtain access tokens


OAuth scope parameter
https://apps-apis.google.com/a/feeds/emailsettings/2.0/

Back to top

Email Settings API HTTP Format

In order to change a user's settings with the Email Settings API, the administrator must make an HTTP request (either a POST, PUT, or a GET) to a certain URL, and when appropriate, with an XML atom entry in the body of the request. The following sections explain the format of the request URL as well as the concept of an XML atom entry; however, for each setting you want to change, consult the specific section in this document for the exact properties to set.

The first step to changing a user's settings with the Email Settings API is to find the URL for the setting you plan to change, and whether it is accessed with a create request (a POST,) or an update request (a PUT), or a retrieve data request (a GET).

The example below shows the format URLs take in the Email Settings API. This particular example adds a new Google Mail filter for a user in your domain. Variables are highlighted in bold, blue text.

https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain}/{username}/{settingID}

The following variables should be filled in to complete the request:

  • domain: The domain of the email address you are creating a filter for.
  • username: The username of the user where the filter is to be created.
  • settingID: This last part of the URI indicates the setting to be changed.

The following table shows different settings which can be changed, their settingIDs, and whether they support POST (create requests), PUT (update requests), GET (retrieve data requests) or DELETE. For more information about the protocol, see Protocol Basics.

Setting settingID POST, PUT, GET, DELETE
Label creation, get settings label POST, GET
Filter creation filter POST
Send-as Alias creatino, get settings sendas POST, GET
Web clip settings webclip PUT
Forwarding settings forwarding PUT, GET
POP settings pop PUT, GET
IMAP settings imap PUT, GET
Vacation-Responder settings vacation PUT, GET
Signature signature PUT, GET
Language settings language PUT
Delegate Gmail access delegation POST, GET, DELETE
General settings general PUT

For example, to create a filter for the user alice on the example.com domain, you would submit an HTTP POST request to the following URL:

https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/alice/filter

Back to top

XML Request Format

The second step is to find the format that the XML body of the request must take for POST and PUT requests. The XML document is a Google Data Atom entry. The <entry> must contain at least one <apps:property> tag. Each <apps:property> tag has a name and a value attribute which describe how the email settings are to be changed— such as describing a filter to be created, or the new values that forwarding settings should take.

The following XML example describes a fairly straightforward filter that will archive every email from the example.com domain with project 1 in the subject header.

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:apps='http://schemas.example.com/apps/2006'>
<apps:property name='from' value='example.com'/>
<apps:property name='subject' value='project 1'/>
<apps:property name='shouldArchive' value='true'/>
</atom:entry>

This example does not show all of the possibilities for creating filters, or explain how to change any of the other settings. The following sections explain in full details the required XML format for each settings operation.

XML Responses

If the filter was created sucessfully, the Email Settings API will return an HTTP 201 or 200 response indicating a successful creation. The body of the response will echo back the create, update, or data retrieval request.

However, if there was an error due to an invalid API request, an HTTP error response is returned. The list of possible HTTP response codes are listed at http://code.google.com/apis/gdata/reference.html#http-status-codes.

If there was an error that occurred during the creation of the filter, an XML error response is returned. The list of possible XML response codes are listed at http://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_reference.html#google_apps_tag_error.

The following is an example of an error that occurred during the creation of a filter:

400 BAD REQUEST

<?xml version="1.0" encoding="UTF-8"?>

<AppsForYourDomainErrors>
<error errorCode="1301" reason="EntityDoesNotExist"
invalidInput="your-invalid-input"/>
</AppsForYourDomainErrors>

Back to top

API Limits and Quotas

Limits and quotas protect the Google infrastructure from an automated process that uses the Email Settings API in an inappropriate way. Excessive requests from an API might result from a harmless typo, or may result from an inefficiently designed system that makes needless API calls. Regardless of the cause, blocking traffic from a specific source once it reaches a certain level is necessary for the overall health of the Google Apps system. It ensures that one developer's actions cannot negatively impact the larger community.

In the unlikely event that your API request fails, you'll receive an HTTP status code response. A status code of 403 has error information about incorrect input, and an HTTP status code of 503 has error information indicating which API quotas have been exceeded. These responses allow your custom application to detect these errors and take appropriate action.

If your requests need to be completed in a fixed period of time, send your requests in parallel or use multiple threads in your Java or C# application. An example of parallel requests is requesting small batches of emails from different users rather than adding or removing lots of emails from one user simultaneously. In the case of threads, try starting with 10 threads, one thread per user email. Note, the thread recommendation has trade-offs and is not useful for all API situations. If the number of requests gets too high, quota errors will occur. Another trade-off example is the Email Settings API's quota for the maximum overall message upload rate. The upload rate is one API request - per second - per user, no matter how many threads are making upload requests.

For all errors that are time based (maximum of N things for N seconds per thread), especially the 503 status code errors, we recommend your code catch the exception and, using an exponential backoff algorithm, wait for a small delay before retrying the failed call. An Email Settings API example for one thread is to wait 5 seconds and retry the failed call. If the request is successful, repeat this pattern for the other threads. If the second request is not successful, your application should scale back on the frequency of the request until a call is successful. For example, increase the initial 5 second delay to 10 seconds and retry your failed call again. Also, decide on a retry limit. For example retry a request 5 to 7 times with different delay times before your application returns an error to the user.

API Limit Categories Limits
Email settings, for a new account If you are changing the settings for a recently provisioned account, you should wait at least one second before making your API calls. This insures that the email account is fully provisioned and activated before any attempt is made to change a user's email settings.
Email settings, for a new delegate Depending on the network, there could be a delay of a minute or less before a new delegate is added. We recommend a delay between the creation of more than one delegate or between the retrieval of newly created delegates.
Language settings It may take several hours for new language settings to be applied.
API Quota Categories Quotas
ClientLogin authentication tokens Valid for 24 hours. The error is '401 token expired'
Error messages To see some common errors, along with the output produced to help diagnose them, see the common errors section of this guide.
Delegation, max delegates per user Each user delegating Gmail access is allowed a maximum of 25 delegates.
Filter, the forwardTo action A filter's forwardTo field must hold a validated email address or an error is returned.
You can create an unlimited number of filters, but, only 20 filters can forward to other addresses.
Filter, settings A filter name can be any HTML encoded string up to 225 characters.

Filter values are case insensitive. For example, HelpDesk@example.com is filtered the same as helpdesk@example.com.

Filters can use Boolean operators. See Boolean operators.

Note: When specifying the subject or words for a filter to match, many non-alphanumeric characters cannot be used. These include square brackets( [ ] ), parentheses ( ), currency symbols, the ampersand ( & ), pound sign ( # ), and the asterisk ( * ).

Filter, the Subject setting A filter's Subject field can be any HTML encoded string up to 1000 characters.
Forwarding, in a non-active account Changes to forwarding settings are only made active once the user agrees to Google's terms of service. Attempting to change the forwarding settings before the user agrees to the terms of service will result in the updated settings being stored, but not made active. Once the user agrees to the terms, then the stored settings will be made active. This prevents users from using the forwarding feature until they have agreed to the terms, but does not prevent administrators from changing the forwarding settings before the user's account has been made active.
Forwarding, valid email address   An email address used in the Forwarding setting must be valid. A valid value of forwardTo is an email address that has been already verified to be used as a forwarding address in the email account, or one that fulfills one of the following criteria:
  • The email address is in the account's primary domain or a subdomain
  • The email address is a domain alias of the account's primary domain

If the value of forwardTo doesn't adhere to one of these rules, setting up of forwarding using the API will fail.

Note: Forwarding and updating settings are not active until the user has agreed to the account's terms of service. Although an administrator can change these properties at any time, the changed settings will be stored and will not take effect until the user has agreed to the account's terms of service.

 Label settings Email has a 225 character limit per label.

There is no limit to the number of emails assigned to a label.

Label names must not conflict with reserved label names in any language for which Google Mail is available. In English, these include inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv.

Note: The caret character (^) is not allowed in a label string.

 Language settings  The Language settings suppors the RFC 3066 standard format, for example en-GB, fr, or ja for British English, French, or Japanese.
  • The RFC 3066 Language Tag format begins with a primary subtag which is optionally followed with more subtags separated by hyphen signs (-).
  • In most cases, the primary subtag is sufficient to specify a language (de, ko, or hi for German, Korean, or Hindi)
  • In some cases, such as English or Chinese, a subtag needs to show which variant of the language to display (en-US or en-GB for US or British English, and zh-CN or zh-TW for simplified or traditional Chinese).
  • Although there are many regional subtags used to represent a certain language, the Email Settings API only accepts the specific tags. See the complete list.
Page size setting The possible number of conversations to be shown per page are 25, 50 or 100.
POP3 and IMAP, in a non-active account Changes to POP and IMAP settings are only made active once the user agrees to Google's terms of service. Attempting to change these settings before the user agrees to the terms of service will result in the updated settings being stored, but not made active. Once the user agrees to the terms, then the stored settings will be made active. This prevents users from using the POP and IMAP features until they have agreed to the terms, but does not prevent administrators from changing these settings before the user's account has been made active.
POP3 and IMAP settings These settings are not active until the user has agreed to the account's terms of service. Although an administrator can change these properties at any time, the changed settings will be stored and will not take effect until the user has agreed to the account's terms of service.
'Send-As' alias setting, size of alias' name An email 'Send-As' alias name can be any HTML encoded string up to 250 characters.
'Send-As' alias setting, verified The verified property shows if the ownership of the email address's domain has been verified. This property must be true (verified), before the Send-As alias address can work.
Signature setting and retrieving When setting an email signature, the plain text string can be up to 2000 characters. An empty string ("") results in no signature, meaning the signature feature is disabled. When setting or retrieving a signature, the API accepts plain or HTML-encoded strings.
Vacation-responder setting The vacation-responder's subject setting can be any HTML encoded string up to 500 characters.

The responder's message body can be any HTML encoded string up to 100KB of characters.

Note: If a contact sends you several messages during a vacation period, the responder's automated reply is sent at most once every 4 days.

Other Types of Limits Limitations and Guidelines
 abuse@example.com and postmaster@example.com  For email in general, Google monitors the postmaster and abuse addresses for problems with your account. Since abuse and postmaster are reserved aliases, you can not use them as usernames, nicknames, or email aliases. See reporting abuse.
Client libraries For the Java client library, use Java 1.5 or later. For a .NET client, use the .NET 1.1 runtime or later, and you should be current with all patches.
Email, administrator's recovery address  The Admin Settings API manages your domain administrator's email recovery address. For recovery address details, see recovery email address.
Email, maximum recipients per email When using your email and outside of the Email Settings API, the maximum number of recipients allowed for each email is 500 recipients.

If you use a POP or IMAP mail client (Microsoft Outlook or Apple Mail, e.g.), the maximum number of recipients for one message is 100 people at a time.

For external recipients, Google will temporarily disable an account for approximately 24 hours if the message being sent is going to more than 500 external recipients per day from a Standard Edition account, or 2000 external recipients per day from a Premier Edition or Education Edition account. This includes the recipients in the message's To:, Cc:, and Bcc: fields. See the help center's sending limits article.

In addition, an account is disabled if the there is a large number of undeliverable messages. For a large number of undeliverable messages, verify your contacts' email addresses and confirm everyone you are sending email are willing to receive it. See the Bulk Senders Guidelines.

Email, MX records and mail flow The Admin Settings API verifies your MX record status. This confirms that your email domain's MX records have been configured and your account has mail flow.
Email, SSO settings The Admin Settings API lets you control how users access the email by adjusting the Single Sign-On (SSO) settings.
Email client, report settings The Reporting API generates an email clients report showing how users in your domain access their hosted accounts on a day-to-day basis. For each day, the report lists the total number of accounts in your domain as well as the number of users in your domain who have access email using WebMail.
External content, viewing default When you receive an email with an externally linked image, the default is for the images not to be displayed. In addition, the default behavior will display the image if the email's sender is someone you have sent an email message at least twice. See display images.
Group email permission settings The Provisioning API manages a new group's subscription permissions.
HTTPS, default The default browser setting is HTTPS.

Note:Possible errors may result when using this setting. See changing HTTPS.

Mailbox, language and domain logo settings The Admin Settings API lets you set the default language for your users' accounts, and the API lets you personalize your mailbox by changing your domain logo.
Mail loops A mail loop often occurs when two accounts are forwarding to each other. When a mail loop is detected, the email system will bounce the message to break the cycle.
Outbound email routing The Admin Settings API configures outbound routing of email from users in your domain.
POP and IMAP supported clients Supported POP client list

Supported IMAP client list

Outside of the Email Settings and when using IMAP email client connections, the limit of simultaneous IMAP connections is 10 connections per account.

Mail clients can open multiple connections in the background. It is possible to reach a connection quota simply by using only two mail clients accessing the same account at the same time. If you commonly use multiple mail clients or mobile devices with the same email account, close or sign out of any mail clients you are not actively using.

User names Usernames can contain letters (a-z), numbers (0-9), dashers (-), underscores (_), and apostrophes ('). Google Apps recognizes dots or periods (.). This is not the same as Gmail.

Back to top

Manage Labels

Creating Labels

Creating labels in Google Mail is accomplished with a POST request to the following URL:

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/label

The following table shows the only property to be set when creating a label.

Name XML attribute Example XML value Description Possible values
label name="label" value="Important" The label to create in Google Mail (any HTML encoded string up to 225 characters-
note that the '^' character is not allowed)

  • Label names must not conflict with reserved label names in Google Mail, which in English include inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv. In addition to this, label names must not conflict with reserved label names in any language which Google Mail is available in. This is by design, as it prevents users from confusing messages in the inbox with messages labelled inbox, regardless of their display language.

Retrieving Labels

Retrieving all labels and their settings in Google Mail is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/label

Note: The retrieved labels do not include the reserved label names such as inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv.

Deleting labels

Deleting a Gmail label is accomplished with a DELETE request to the following URL:

DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/label/{label name}

Note: Label names must use URL encoding, replacing spaces with "+". For more information, see Percent-encoding.

Label Examples

Example 1, Creating a label

  • The user name is ben.
  • The label "status updates" will be created for Ben.

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/label

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="label" value="status updates" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.createLabel(users, "status updates");
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.CreateLabel(username='ben', name='status updates')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.CreateLabel("ben", "status updates");

Example 2, retrieving all labels

  • The domain name is example.com and the user name is venu
  • The unreadCount property gives the number of emails that have this label assigned to them and are still unread. There is no quota limit to the number of emails assigned to a label.
  • The visibility property specifies whether the label is visible in the Google Mail user interface or is found in the more drop down box. This property's value is either SHOW in the interface, or HIDE in the drop down box.

  <atom:feed xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'>
    <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label</atom:id>
    <atom:updated>2010-03-17T15:29:21.064Z</atom:updated>
    <atom:link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label'/>
    <atom:link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label'/>
    <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label'/>
    <openSearch:startIndex>1</openSearch:startIndex>
    <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/domain/example.com/venu/label/id1</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id1'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id1'/>
        <apps:property name='labelId' value='id1'/>
        <apps:property name='label' value='VenuLabel'/>
        <apps:property name='unreadCount' value='20'/>
        <apps:property name='visibility' value='SHOW'/>
   </atom:entry>
   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id2</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id2'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id2'/>
        <apps:property name='labelId' value='id2'/>
        <apps:property name='label' value='testLabel'/>
        <apps:property name='unreadCount' value='0'/>
        <apps:property name='visibility' value='HIDE'/>
   </atom:entry>
   </atom:feed>
  
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveLabel("venu");
  
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveLabels(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedFeed labels = service.RetrieveLabels("venu");

Example 3, Deleting a label

  • The user name is ben.
  • The label "status updates" will be deleted for Ben.

DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/label/status+updates
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.DeleteLabel(username='ben', label='status updates')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.DeleteLabel("ben", "status updates");

Back to top

Manage Filters

Creating a Filter

Creating a Google Mail filter is accomplished with a POST request to the following URL:

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/filter

The following two tables shows the properties to be set when creating a filter. The first table shows what you can filter on, the second what action you can take, and their corresponding XML attributes. At least one property from the first table and one from the second table must be set.

Filter Criteria Properties

Name XML attribute Example XML value Description Possible values
From name="from" value="jane@example.com" The email must come from this address in order to be filtered. (a valid email address up to 400 characters)
To name="to" value="bob@example.com" The email must be sent to this address in order to be filtered. (a valid email address up to 400 characters)
Subject name="subject" value="project" A string the email must have in its subject line to be filtered. (any HTML encoded string up to 1000 characters*)
Has the words name="hasTheWord" value="work" A string the email can have anywhere in it's subject or body. (any HTML encoded string up to 1000 characters*)
Doesn't have name="doesNotHaveTheWord" value="proposal" A string that the email cannot have anywhere in its subject or body. (any HTML encoded string up to 1000 characters*)
Has attachment name="hasAttachment" value="true" A boolean representing whether or not the email contains an attachment. "true" or "false"

Note: when specifying the subjects or the words for the filter to match, many non-alphanumeric characters cannot be used. Disallowed characters include square brackets, parentheses, currency symbols, the ampersand, the pound sign and asterisks.

  • Filter criteria values are case insensitive. JaneDoe@example.com is filtered the same as janedoe@example.com.
  • Boolean operators are available for creating filters. See the following Google Mail Help Center topic for more information: http://mail.google.com/support/bin/answer.py?answer=8931.

Filter Action Properties

Action XML attribute Example XML value Description Possible values
Archive it name="shouldArchive" value="true" Whether to automatically move the message to "Archived" state if it matches the specified filter criteria "true" or "false"
Mark as read name="shouldMarkAsRead" value="true" Whether to automatically mark the message as read if it matches the specified filter criteria "true" or "false"
Star it name="shouldStar" value="true" Whether to automatically star the message if it matches the specified filter criteria "true" or "false"
Apply the label name="label" value="example.com work" The name of the label to apply if a message matches the specified fitler criteria.f Any HTML encoded string up to 225 characters. Note, the '^' character is not allowed.
Forward it name="forwardTo" value="liz@example.com" Whether to automatically forward the message to the given verified email address if it matches the filter criteria. The forwarding email address must be validated or an error is returned. A valid email address within the domain, subdomain, or domain alias configured within the same Google Apps account.
Delete it name="shouldTrash" value="false" Whether to automatically move the message to "Trash" state if it matches the specified filter criteria "true" or "false"
Never send it to Spam name="neverSpam" value="true" Whether to automatically move the message to "Spam" state if it matches the specified filter criteria "true" or "false"

  • Filters can be created for labels that already exist - the created filter will simply label incoming mail with the existing label.
  • Note that certain label names are reserved - see the labels section above.
  • The table lists the action properties in the order that they are applied. This is independent of the order of the actions listed in the body of the API request or response.

Filter Creation Examples

Example 1

  • The user name is liz.
  • The email is from Alice's other email account, alice@gmail.com.
  • The email's subject contains the string project proposal.
  • Emails filtered by this criteria are marked as read.

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/filter

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="from" value="alice@gmail.com" />
<apps:property name="hasTheWord" value="project proposal" />
<apps:property name="shouldMarkAsRead" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.createFilter(users,
                    "alice@gmail.com",  // from
                    "",                 // to
                    "",                 // subject
                    "project proposal", // hasTheWord
                    "",                 // doesNotHaveTheWord
                    false,              // hasAttachment
                    true,               // shouldMarkAsRead
                    false,              // shouldArchive
                    "");                // label
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.CreateFilter(username='liz', from_address='alice@gmail.com', has_the_word='project proposal', mark_as_read=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.createFilter("liz",              // target user
                     "alice@gmail.com",  // from
                     "",                 // to
                     "",                 // subject
                     "project proposal", // hasTheWords
                     "",                 // doesNotHaveTheWords
                     "false",            // hasAttachment
                     "",                 // label
                     "true",             // shouldMarkAsRead
                     "false");           // shouldArchive

Example 2

  • The username is ben.
  • The email is sent to announcements@example.com.
  • Emails filtered by this criteria are labeled announcements.

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/filter

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="to" value="announcements@example.com" />
<apps:property name="label" value="announcements" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.createFilter(users,
                    "",                          // from
                    "announcements@example.com", // to
                    "",                          // subject
                    "",                          // hasTheWord
                    "",                          // doesNotHaveTheWord
                    false,                       // hasAttachment
                    false,                       // shouldMarkAsRead
                    false,                       // shouldArchive
                    "announcements");            // label
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.CreateFilter(username='ben', to_address='announcements@example.com', label='announcements')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.createFilter("ben",              // target user
                     "",                 // from
                     "announcements@example.com",  // to
                     "",                 // subject
                     "",                 // hasTheWords
                     "",                 // doesNotHaveTheWords
                     "false",            // hasAttachment
                     "announcements",    // label
                     "false",            // shouldMarkAsRead
                     "false");           // shouldArchive

Back to top

Manage Send-as Alias

Creating a Send-as Alias

Creating a Google Mail send-as alias is accomplished with a POST request to the following URL:

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/sendas

The following table shows the properties to be set when creating a send-as Alias.

Name XML attribute Example XML value Description Possible values
name name="name" value="Network Support" The name that will appear in the "From" field for this user. Any HTML encoded string up to 250 characters.
address name="address" value="support@example.com" The email address that appears as the origination address for emails sent by this user. Any email address which exists as a user or an alias on the hosted domain.
replyTo name="replyTo" value="liz@example.net" (Optional) If set, this address will be included as the reply-to address in emails sent using the alias. Any valid email address.
makeDefault name="makeDefault" value="true" (Optional) If set to true, this alias will be become the new default alias to send-as for this user. "true" or "false"

Retrieving Send-as Alias Settings

Retrieving all Google Mail Send-As alias settings is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/sendas

Send-as Alias Examples

Example 1, Creating a Send-as alias

  • The user name is liz.
  • The send-as alias will allow Liz to send as Sales, with the email address sales@example.com.
  • This alias will be selected for Liz by default.

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/sendas

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="name" value="Sales" />
<apps:property name="address" value="sales@example.com" />
<apps:property name="makeDefault" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.createSendAs(users,
                     "Sales",             // name
                     "sales@example.com", // address
                     "",                  // replyTo
                     true);               // makeDefault
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.CreateSendAs(username='liz', name='Sales', address='sales@example.com', make_default=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.CreateSendAs("liz", "Sales", "sales@example.com", "", "true");

Example 2, Creating a Send-as alias

  • The username is ben.
  • The send-as alias will allow Ben to send as Support with the email address support@example.com.
  • The reply-to will be set to another address, b.smith@gmail.com.

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/sendas

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="name" value="Support" />
<apps:property name="address" value="support@example.com" />
<apps:property name="replyTo" value="b.smith@gmail.com" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.createSendAs(users,
                     "Support",             // name
                     "support@example.com", // address
                     "b.smith@gmail.com",   // replyTo
                     false);                // makeDefault
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.CreateSendAs(username='ben', name='Support', address='support@example.com', reply_to='b.smith@gmail.com')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.CreateSendAs("ben", "Support", "support@example.com", "b.smith@gmail.com", "false");

Example 3, retrieval of all send-as alias

  • The domain name is example.com and the user name is venu.
  • The verified property shows if the ownership of the email address's domain has been verified. This property must be true (verified), before the Send-As alias address can work.

  <atom:feed xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'>
    <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas</atom:id>
    <atom:updated>2010-03-17T15:29:21.064Z</atom:updated>
    <atom:link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas'/>
    <atom:link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas'/>
    <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas'/>
    <openSearch:startIndex>1</openSearch:startIndex>/id1
    <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id1</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id1'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id1'/>
        <apps:property name='sendAsId' value='id1'/>
        <apps:property name='address' value='ankur@example.com'/>
        <apps:property name='name' value='ankur'/>
        <apps:property name='replyTo' value='replyto@example.com'/>
        <apps:property name='isDefault' value='true'/>
        <apps:property name='verified' value='true'/>
   </atom:entry>
   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id2</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id2'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id2'/>
        <apps:property name='sendAsId' value='id2'/>
        <apps:property name='address' value='namrata@example.com'/>
        <apps:property name='name' value='namrata'/>
        <apps:property name='replyTo' value='replyto@example.com'/>
        <apps:property name='isDefault' value='true'/>
        <apps:property name='verified' value='true'/>
   </atom:entry>
   </atom:feed>
  
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveSendAs("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveSendAs(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedFeed sendas = service.RetrieveSendAs("venu");

Back to top

Manage Web Clips

Updating Web Clip Settings

Updating Google Mail web clip settings is accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/webclip

The following table shows the only property to be set when updating web clip settings.

Name XML attribute Example XML value Description Possible values
enable name="enable" value="true" Whether to enable showing Web clips. "true" or "false"

Web Clip Settings Examples

Example 1

  • The user name is ben.
  • Web clip service is to be enabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/webclip

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
</atom:entry>
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateWebclip(username='ben', enable=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateWebclip("ben", "true");

Example 2

  • The username is ben.
  • Web clip service is to be disabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/webclip

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateWebclip(username='ben', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateWebclip("ben", "false");

Back to top

Manage Forwarding Settings

Updating Forwarding Settings

Updating Google Mail Forwarding settings is accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/forwarding

Note: Although an administrator can change these properties at any time, the changed settings will only take effect once the user has agreed to the terms of service.

The following table shows the properties to be set when updating forwarding settings. Note that all properties are required to enable forwarding settings (but setting enable to false is enough to disable).

Name XML attribute Example XML value Description Possible values
enable name="enable" value="true" Whether to enable forwarding of incoming mail. "true" or "false"
forwardTo name="forwardTo" value="fred@example.com" The email will be forwarded to this address. A valid email address — see note below
action name="action" value="KEEP" What Google Mail should do with its copy of the email after forwarding it on. "KEEP" (in inbox), "ARCHIVE", or "DELETE" (send to spam), or "MARK_READ" (marked as read)

Note: A valid value of forwardTo is an email address that has been already verified to be used as a forwarding address in the Google Mail account, or one that fulfills one of the following criteria:

1. It belongs to the same domain,
2. It belongs to a subdomain of the same domain, or
3. It belongs to a domain alias configured as part of the same Google Apps account.

If the value of forwardTo doesn't adhere to one of these rules, setting up forwarding via the API will fail.

Retrieving Forwarding Settings

Retrieving Google Mail forwarding settings is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/forwarding
  

Forwarding Settings Examples

Example 1, forwarding all emails

  • The user name is liz.
  • All emails are to be forwarded to another address, alice@example.net.
  • No further action is to be taken - the forwarded emails are to be kept in the inbox.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/forwarding

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="forwardTo" value="alice@example.net" />
<apps:property name="action" value="KEEP" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeForwarding(users,
                         true,                // enable
                         "alice@example.com", // forwardTo
                         "KEEP");             // action
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateForwarding(username='liz', enable=True, forward_to='alice@example.net', action='KEEP')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateForwarding("liz", "true", "alice@example.net", "KEEP");

Example 2, forwarding to another address and archived

  • The user name is ben.
  • All emails are to be forwarded to another address: b.smith@example.com (assuming b.smith@example.com is an already-verified forwarding address).
  • Once forwarded, the emails are to be archived.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/forwarding

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="forwardTo" value="b.smith@example.com" />
<apps:property name="action" value="ARCHIVE" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeForwarding(users,
                         true,                // enable
                         "b.smith@example.com", // forwardTo
                         "ARCHIVE");          // action
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateForwarding(username='ben', enable=True, forward_to='b.smith@example.com', action='ARCHIVE')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateForwarding("ben", "true", "b.smith@example.com", "ARCHIVE");

Example 3, email no longer forwarded

  • The user name is liz.
  • Emails are no longer to be forwarded to another address.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/forwarding

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeForwarding(users,
                         false, // enable
                         "",    // forwardTo
                         "");   // action
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateForwarding(username='liz', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateForwarding("liz", "false", null, null);

Example 4, retrieving the email forwarding settings

The domain name is example.com and the user name is venu.

    The action property has these values:
  • KEEP - Emails are left in the inbox.
  • ARCHIVE - Emails are archived, and, by default, are not visible in the inbox.
  • DELETE - When deleted, emails are moved to the Spam folder.
  • MARK_READ - Emails are marked as read in the inbox.

   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/forwarding</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/forwarding'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/forwarding'/>
        <apps:property name='enable' value='true'/>
        <apps:property name='forwardTo' value='venu@example.com'/>
        <apps:property name='action' value='DELETE'/>
   </atom:entry>
  
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveForwarding("venu");
  
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveForwarding(username='venu')
  
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedEntry forwarding = service.RetrieveForwarding("venu");

Back to top

Manage POP Settings

Updating POP Settings

Updating Google Mail POP settings is accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/pop

Note: Although an administrator can change these properties at any time, the changed settings will only take effect once the user has agreed to the terms of service.

The following table shows the properties to be set when updating POP settings. Note that all properties are required to enable POP settings (but setting enable to false is enough to disable).

Name XML attribute Example XML value Description Possible values
enable name="enable" value="true" Whether to enable POP access. "true" or "false"
enableFor name="enableFor" value="ALL_MAIL" Whether to enable POP for all mail, or mail from now on. "ALL_MAIL", "MAIL_FROM_NOW_ON"
action name="action" value="KEEP" What Google Mail should do with its copy of the email after it is retrieved using POP. "KEEP" (in inbox), "ARCHIVE", or "DELETE" (send to trash)

Retrieving POP Settings

Retrieving Google Mail POP settings is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/pop

POP Settings Examples

Example 1, POP access is enabled and email kept in inbox

  • The user name is liz.
  • POP access is to be enabled from now on.
  • Emails accessed with POP are to be kept in the inbox.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/pop

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="enableFor" value="MAIL_FROM_NOW_ON" />
<apps:property name="action" value="KEEP" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changePop(users,
                  true,               // enable
                  "MAIL_FROM_NOW_ON", // enableFor
                  "KEEP");            // action
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdatePop(username='liz', enable=True, enable_for='MAIL_FROM_NOW_ON', action='KEEP')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdatePop("liz", "true", "MAIL_FROM_NOW_ON", "KEEP");

Example 2, POP access for all mail and deleted after accessed

  • The user name is ben.
  • POP access is to be enabled for all mail, not just mail that arrives from now on.
  • Once accessed with POP, the emails are to be deleted (moved into trash, which is emptied over time).

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/pop

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="enableFor" value="ALL_MAIL" />
<apps:property name="action" value="DELETE" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changePop(users,
                  true,       // enable
                  "ALL_MAIL", // enableFor
                  "DELETE");  // action
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdatePop(username='ben', enable=True, enable_for='ALL_MAIL', action='DELETE')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdatePop("ben", "true", "ALL_MAIL", "DELETE");

Example 3, POP access is disabled

  • The user name is liz.
  • POP access is to be disabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/pop

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changePop(users,
                  false, // enable
                  "",    // enableFor
                  "");   // action
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdatePop(username='liz', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdatePop("liz", "false", null, null);

Example 4, retrieving all POP access settings

The domain name is example.com and the user name is venu.

    The action property has these values:
  • KEEP - Emails are left in the inbox.
  • ARCHIVE - Emails are archived, and, by default, are not visible in the inbox.
  • DELETE - When deleted, emails are moved to the Spam folder.
  • MARK_READ - Emails are marked as read in the inbox.

   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/pop</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/pop'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/pop'/>
        <apps:property name='enable' value='true'/>
        <apps:property name='action' value='ARCHIVE'/>
   </atom:entry>
  
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrievePop("venu");
  
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrievePop(username='venu')
  
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedEntry pop = service.RetrievePop("venu");

Back to top

Manage IMAP Settings

Updating IMAP Settings

Updating Google Mail IMAP settings is accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{use name}/imap

Note: Although an administrator can change these properties at any time, the changed settings will only take effect once the user has agreed to the terms of service.

The following table shows the only property to be set when updating IMAP settings.

Name XML attribute Example XML value Description Possible values
enable name="enable" value="true" Whether to enable IMAP access. "true" or "false"

Retrieving Google Mail IMAP Settings

Retrieving Google Mail IMAP settings is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/imap

IMAP Settings Examples

Example 1, enabling IMAP access

  • The user name is ben.
  • IMAP access is to be enabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/imap

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeImap(users, true); // enable
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateImap(username='ben', enable=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateImap("ben", "true");

Example 2, disable IMAP access

  • The user name is ben.
  • IMAP access is to be disabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/imap

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeImap(users, false); // enable
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateImap(username='ben', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateImap("ben", "false");

Example 3, retrieving IMAP settings

The domain name is example.com and the user name is venu.

   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/imap</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/imap'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/imap'/>
        <apps:property name='enable' value='true'/>
   </atom:entry>
  
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveImap("venu");
  
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveImap(username='venu')
  
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedEntry imap = service.RetrieveImap("venu");

Back to top

Manage Vacation-Responder Settings

Updating Vacation-Responder Settings

Updating Google Mail vacation-responder settings is accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/vacation

The following table shows the properties to be set when updating Vacation-responder settings.

Name XML attribute Example XML value Description Possible values
contactsOnly name="contactsOnly" value="true" Whether to only send the autoresponse to known contacts. "true" or "false"
domainOnly name="domainOnly" value="true" Whether to only send the autoresponse to users in the same primary domain as the user taking the vacation. "true" or "false"
The default is "false".
enable name="enable" value="true" Whether to enable the vacation-responder. "true" or "false"
endDate name="endDate" value="2011-06-23" The last day until which vacation responder is enabled for the user. In this version of the API, the endDate is the UTC timezone, not the user's timezone. Also see the startDate property. "YYYY-MM-DD"
message name="message" value="I won&#39;t be checking email until the 28th." The message body of the vacation-responder autoresponse.. (any HTML encoded string up to 100 KB of characters)
startDate name="startDate" value="2011-06-20" The first day when the vacation responder was enabled for the user. In this version of the API, the startDate is in the UTC timezone, not the user's timezone. Also see the endDate property. "YYYY-MM-DD"
subject name="subject" value="On vacation!" The subject line of the vacation-responder autoresponse. (any HTML encoded string up to 500 characters)

Retrieving Vacation-Responder Settings

Retrieving Google Mail vacation-responder settings is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/vacation

Vacation-Responder Settings Examples

Example 1, vacation-responder enabled and autoreply to contacts

  • The user name is ben.
  • The vacation-responder is to be enabled.
  • The autoreply will only be sent to those people who are in Ben's list of contacts who may or may not be in the same primary domain as Ben.
  • If the vacation is for one day, the startDate value would be the same date as the endDate value.
  • Note that all strings have been HTML encoded where necessary.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/vacation

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="subject" value="Out of office" />
<apps:property name="message" value="If it&#39;s urgent you can contact me on 555-5555." />
<apps:property name="contactsOnly" value="true" />
<apps:property name="domainOnly" value="false" />
<apps:property name="startDate" value="2011-06-20" />
<apps:property name="endDate" value="2011-06-23" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeVacation(users,
                       true,                                                 // enable
                       "Out of office",                                      // subject
                       "If it&#39;s urgent you can contact me on 555-5555.", // message
                       true);                                                // contactOnly
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateVacation(username='ben', enable=True, subject='Out of office', message="If it's urgent you can contact me on 555-5555.", contacts_only=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateVacation("ben", "true", "Out of office", "If it's urgent you can contact me on 555-5555.", "true");

Example 2, vacation-responder disabled

  • The user name is liz.
  • The vacation-responder is to be disabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/vacation

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeVacation(users,
                       false,  // enable
                       "",     // subject
                       "",     // message
                       false); // contactOnly
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateVacation(username='liz', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateVacation("liz", "false", null, null, null);

Example 3, retrieving vacation-responder settings

  • The domain name is example.com and the user name is venu.
  • When the 'enable' property is 'true', the response returns the vacation request's startDate, endDate, and domainOnly properties.

   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/vacation</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/vacation'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/vacation'/>
        <apps:property name='enable' value='true'/>
        <apps:property name='subject' value='Vacation today'/>
        <apps:property name='message' value='This is my vacation-responder message'/>
        <apps:property name='contactsOnly' value='true'/>
        <apps:property name='domainOnly' value='false'/>
        <apps:property name='startDate' value='2011-06-20'/>
        <apps:property name='endDate' value='2011-06-23'/>
   </atom:entry>
   
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveVacation("venu");
   
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveVacation(username='venu')
   
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedEntry vacation = service.RetrieveVacation("venu");

Back to top

Manage Signature Settings

Updating a Signature

Updating the Google Mail signature is accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/signature

The following table shows the only property to be set when updating the signature.

Name XML attribute Example XML value Description Possible values
signature name="signature" value="Regards,
Joe."
The signature to be appended to outgoing messages.
  • Don't want a signature? Set the signature to "" (empty string).
When setting a signature, the API accepts a plain text string up to 2000 characters. The API supports setting and retrieving HTML-encoded signatures. For no signature, set the property to the empty string ("").

Retrieving Signature Setting

Retrieving a Google Mail signature setting is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/signature

Signature Examples

Example 1, setting signature and contact details

  • The user name is liz.
  • Her signature is to be set to include her name and contact details, on separate lines.
  • Note when setting a signature, the string is plain text.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/signature

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="signature" value="Liz Jones - (+1) 619-555-5555
Accounts Management, A&amp;Z LTD." />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeSignature(users,
                        "Liz Jones - (+1) 619-555-5555" +
                        "Accounts Management, A&Z LTD."); // signature
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateSignature(username='liz', signature="Liz Jones - (+1) 619-555-5555" +
                                                 "Accounts Management, A&Z LTD.")
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateSignature("liz", "Liz Jones - (+1) 619-555-5555" +
                             "Accounts Management, A&Z LTD.");

Example 2, signature disabled

  • The user name is liz.
  • Her signature is to be disabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/signature

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="signature" value="" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeSignature(user, ""); // signature
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateSignature(username='liz', signature='')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateSignature("liz", "");

Example 3, retrieving Google mail signature settings

The domain name is example.com and the user name is venu.

   <atom:entry>
        <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/signature</atom:id>
        <atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
        <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/signature'/>
        <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/signature'/>
        <apps:property name='signature' value='Regards from Venu at the help desk'/>
   </atom:entry>
  
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveSignature("venu");
  
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveSignature(username='venu')
  
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedEntry signature = service.RetrieveSignature("venu");

Back to top

Manage Language Settings

Updating Language Settings

Updating the display language setting in Google Mail can be accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/language

The following table shows the only property to be set when updating the display language.

Name XML attribute Example XML value Description Possible values
language name="language" value="en-US" Google Mail's display language Language Tag according to RFC 3066, for any language that Google Mail supports.
e.g. "en-GB", "fr" or "ja" for British English, French, or Japanese
See complete list below.

  • The RFC 3066 Language Tag format begins with a primary subtag, optionally followed with more subtags separated by hyphens/minus signs, '-'.
  • In most cases, the primary subtag will be all you will need to specify the language (e.g. "de", "ko" or "hi" for German, Korean or Hindi).
  • In a few cases, such as English or Chinese, you will need a subtag to show which variant of the language to display (e.g. "en-US" or "en-GB" for US or British English, and "zh-CN" or "zh-TW" for simplified or traditional Chinese).
  • Note that in many cases, although there are many regional subtags which could represent a certain language, for technical reasons the Email Settings API will only accept the ones listed in the table below - so instead of "zh-HK", send "zh-TW" to mean Chinese (traditional).

Note: It may take several hours for new language settings to be applied.

Language Examples

Example 1

  • The user name is liz.
  • Liz's Google Mail display will be in German next time she signs in. (The RFC 3066 tag for German is "de")

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/language

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="language" value="de" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeLanguage(users, "de"); // language
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateLanguage(username='liz', language='de')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateLanguage("liz", "de");

Language Tags

English name for language Language (as displayed in Google Mail) RFC 3066 Language Tag
accepted by Google Mail
Arabicالعربيةar
Bengaliবাংলাbn
BulgarianБългарскиbg
CatalanCatalàca
Chinese (Simplified)中文(简体)zh-CN
Chinese (Traditional)中文(繁體)zh-TW
CroatianHrvatskihr
CzechČeskýcs
DanishDanskda
DutchNederlandsnl
English (United States)English (US)en-US
English (United Kingdom)English (UK)en-GB
EstonianEesti keelet
FinnishSuomifi
FrenchFrançaisfr
GermanDeutschde
GreekΕλληνικάel
Gujaratiગુજરાતીgu
Hebrewעבריתiw
Hindiहिन्दीhi
HungarianMagyarhu
IcelandicÍslenskais
IndonesianBahasa Indonesiain
ItalianItalianoit
Japanese日本語ja
Kannadaಕನ್ನಡkn
Korean한국어ko
LatvianLatviešulv
LithuanianLietuviųlt
MalayBahasa Melayums
Malayalamമലയാളംml
Marathiमराठीmr
NorwegianNorsk (Bokmål)no
Oriyaଓଡିଆ (Oriya)or
Persianفارسیfa
PolishPolskipl
Portuguese (Brazil)Português (Brasil)pt-BR
Portuguese (Portugal)Português (Portugal)pt-PT
RomanianRomânăro
RussianРусскийru
SerbianСрпскиsr
SlovakSlovenskýsk
SlovenianSlovenščinasl
SpanishEspañoles
SwedishSvenskasv
TagalogFilipinotl
Tamilதமிழ்ta
Teluguతెలుగుte
Thaiภาษาไทยth
TurkishTürkçetr
UkrainianУкраїнськаuk
Urduاردوur
VietnameseTiếng Việtvi

Back to top

Manage Delegation Settings

Adding a Gmail Delegate

A Gmail user can grant mailbox access to another user in the same domain. The user granting access is the delegator. The user receiving the access is the delegate.

Both the Gmail delegator and the delegate:

  • Must be active. A 500 error is returned if either user is suspended and disabled.
  • Do not require a change of password in 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.

A Gmail delegate:

  • Can read, send, and delete messages in the delegator's mailbox.
  • Can access the delegator's contacts using the user interface's Contacts link as well as selecting the To, Cc, or Bcc links in the mail compose window.
  • Can not change the delegator's account password, settings, or chat in behalf of the delegator.

Users in your account will not see or use delegation updates until the account's delegation feature is enabled. To enable the delegation feature in the control panel, select Email in the Service settings tab. And on the General settings page, enable Mail Delegation.

Once delegation is enabled, an API administrator grants a delegate access to a delegator's mailbox. This is different from the user interface where, once delegation is enabled, users grant access for their own mailboxes.

Tip: Establish an account policy for how and when delegates are added to a user's mailbox. By setting user expectations, a clear delegation policy helps manage your account maintenance overhead and mitigates user confusion.

Creating a Gmail delegate is accomplished with a POST request to the following URL:

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name of delegator}/delegation

When a new delegate is created, there may be a minute or less delay before the new delegate is available. We recommend your client application has a delay between the creation of more than one delegate or between the retrieval of a newly created delegate.

The following table shows the URI arguments used when creating a Gmail delegate.

Name Example value Description
domain name example.com A primary domain name
user name of the delegator liz The name used in the primary email address. or a user alias of the user granting access. This is the delegator. No delegation notification is sent to the delegate when a delegation assignment has been added.

Note: For multiple domain accounts, an API administrator can not grant Gmail access if the delegator and delegate users belong to different domains.

The following table shows the properties to be set when creating a delegate.

Name XML attribute Example XML value Description Possible values
address address="email address" value="liz@example.com" The name of the user given access to a Gmail account. A delegate can read, send, and delete messages on the behalf of the user who owns the Gmail account (the delegator). A primary email address or an alias. The API allows a maximum of 25 delegates for each delegator.

Note: If transitioning to the new infrastructure for Google Apps accounts, both the the domain used by the delegate and the primary account's domain have to have been transitioned before making an API delegation request.

Retrieving All Gmail Delegates

Retrieving all Gmail delegates for a specific delegator is accomplished with a GET request to the following URL:

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name of delegator}/delegation

Note: The mail delegation feature must be enabled before retrieving delegates. For more information, see Adding a Gmail Delegate.

The following table shows the response's delegate status propery.

Name XML attribute Example XML value Description Possible values
status status="status setting" status="ACCEPTED" The status of the delegated access.

ACCEPTED -- Status when the delegate has access to the delegator's mailbox. If a delegate has been added using the API, this is the default status.

PENDING -- Status if a delegate has been added by the delegator using the user interface, the delegate's access is in pending state until the delegate confirms the access given to him.

REJECTED -- Status if a delegate has been added by the delegator in the user interface, and delegate has rejected the access given to him.

Deleting a Gmail Delegate

Deleting a Gmail delegate is accomplished with a DELETE request to the following URL:

DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name of delegator}/
delegation/{email ID of delegate}

Note: Delegates with PENDING or REJECTED status can not be deleted using the API. And, the mail delegation feature must be enabled before deleting a delegate. For more information, see Adding a Gmail Delegate.

Delegation Examples

Example 1, creating a delegate

  • The domain name is example.com. The user delegating access, the delegator, is liz.
  • The delegate getting access, the address, is ankur@example.com.

POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/delegation/
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="address" value="ankur@example.com" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.addEmailDelegate("liz", "ankur@example.com");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.AddEmailDelegate(username='liz', address='ankur@example.com')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedEntry entry = service.CreateDelegate("liz", "ankur@example.com");

Example 2, retrieving all delegates for a specific delegator

  • The domain name is example.com. The user delegating access (the delegator) is venu.
  • The PENDING delegate is ankur, and the address, is ankur@example.com. This delegate was added using the user interface.
  • The ACCEPTED delegate is piyush, and the address is piyush@example.com. This delegate either was added using the user interface or the API.

GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/

Response for this example

<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/
example.com/venu/delegation/'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/
example.com/venu/delegation/'/>
<apps:property name='delegationId' value='ankur@example.com'/>
<apps:property name='delegate' value='ankur'/>
<apps:property name='address' value='ankur@example.com'/>
<apps:property name='status' value='PENDING'/>
</atom:entry>
<atom:entry> <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/</atom:id> <atom:updated>2009-04-17T15:29:21.064Z</atom:updated> <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/ example.com/venu/delegation/'/> <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/ example.com/venu/delegation/'/> <apps:property name='delegationId' value='piyush@example.com'/> <apps:property name='delegate' value='piyush'/> <apps:property name='address' value='piyush@example.com'/> <apps:property name='status' value='ACCEPTED'/> </atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveEmailDelegates("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveEmailDelegates(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

AppsExtendedFeed delegates = service.RetrieveDelegates("venu");

Example 3, deleting a delegate

  • The domain is example.com and the user name of the user who granted access (the delegator) is venu.
  • The email address of the delegate being deleted is piyush@example.com.

DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/piyush@example.com
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.deleteEmailDelegate("venu", "piyush@example.com");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.DeleteEmailDelegate(username='venu', address='piyush@example.com')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.DeleteDelegate("venu", "piyush@example.com");

Back to top

Manage General Settings

Updating General Settings

Updating various Google Mail General settings can be accomplished with a PUT request to the following URL:

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain}/{username}/general

The following table shows the properties to be set when updating general settings. A request should contain at least one of these properties, but need not contain all five.

Name XML attribute Example XML value Description Possible values
pageSize name="pageSize" value="50" The number of conversations to be shown per page. "25", "50" or "100"
shortcuts name="shortcuts" value="true" Whether to enable keyboard shortcuts "true" or "false"
arrows name="arrows" value="true" Whether to display arrow-shaped personal indicators next to emails that were sent specifically to the user. (  and » ) "true" or "false"
snippets name="snippets" value="true" Whether to display snippets of messages in the inbox and when searching. "true" or "false"
unicode name="unicode" value="true" Whether to use UTF-8 (unicode) encoding for all outgoing messages, instead of the default text encoding. "true" or "false"

General Settings Examples

Example 1

  • The username is liz.
  • Her page size is to be set to show only 25 conversations per page.
  • Personal indicators (arrows) are to be enabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/general

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="pageSize" value="25" />
<apps:property name="arrows" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeGeneral(users,
                      "25",   // pageSize
                      false,  // shortcuts
                      true,   // arrows
                      false,  // snippets
                      false); // unicode
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateGeneralSettings(username='liz', page_size=25, arrows=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateGeneralSettings("liz",    // target user
                              "25",     // pageSize
                              "false",  // shortcuts
                              "true",   // arrows
                              "false",  // snippets
                              "false"); // unicode

Example 2

  • The username is liz.
  • Keyboard shortcuts are to be disabled.

PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/general

<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="shortcuts" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeGeneral(users,
                      "25",   // pageSize
                      true,   // shortcuts
                      false,  // arrows
                      false,  // snippets
                      false); // unicode
import gdata.apps.emailsettings.client
...

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateGeneralSettings(username='liz', shortcuts=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...

GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");

service.UpdateGeneralSettings("liz",    // target user
                              "25",     // pageSize
                              "true",   // shortcuts
                              "false",  // arrows
                              "false",  // snippets
                              "false"); // unicode

Back to top

Errors

Common Errors for Email Settings API


Incorrect URI


Request
PUT https://apps-apis.google.com/a/feeeds/emailsettings/2.0/example.com/johndoe/language
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="language" value="ko" />
</atom:entry>
Response
HTTP/1.1 302 Found
Connection: Close
Location: http://www.google.com
Content-Type: text/html; charset=UTF-8

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com">here</A>.
</BODY></HTML>

Invalid domain user


Request
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/invaliduser/language
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="language" value="ko" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?>
<AppsForYourDomainErrors>
  <error errorCode="1301" invalidInput="" reason="EntityDoesNotExist" />
</AppsForYourDomainErrors>

Incorrect HTTP method (POST instead of PUT)


Request
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/language
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="language" value="ko" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

Invalid request URI.

Incorrect version in URI (1.0 instead of 2.0)


Request
PUT https://apps-apis.google.com/a/feeds/user/1.0/example.com/johndoe/language
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="language" value="ko" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

Invalid request URI.

No XML sent in request


Request
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/language
<!-- missing XML. -->
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

Premature end of file.

Request missing a required boolean field


Request
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/vacation
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <!-- Property "enable" is missing. -->
  <apps:property name="subject" value="Out of office" />
  <apps:property name="message" value="If it's urgent you can contact me on 555-5555." />
  <apps:property name="contactsOnly" value="true" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

Required field missing: enable

Request missing a required string


Request
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/sendas
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <!-- Property "name" is missing. -->
  <apps:property name="address" value="sales@example.com" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

Required field missing: name

Property exceeds char count


Request
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/filter
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="from" value="alice@gmail.com" />
  <apps:property name="hasTheWord" value="project proposal" />
  <apps:property name="shouldMarkAsRead" value="true" />
  <apps:property name="label" value="01234567890123456789012345678901234567890" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

Must be at most 225 characters: label

Misspelled tags


Request
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/filter
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="from" value="alice@gmail.com" />
  <apps:property name="hasTheWord" value="project proposal" />
  <aapps:property name="shouldMarkAsRead" value="true" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/plain; charset=UTF-8

The prefix &quot;aapps&quot; for element &quot;aapps:property&quot; is not bound.

Request for Send As contains an invalid user


Request
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/sendas
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="name" value="Sales" />
  <apps:property name="address" value="invaliduser@example.com" />
</atom:entry>
Response
HTTP/1.1 400 Bad Request
Connection: Close
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?>
<AppsForYourDomainErrors>
  <error errorCode="1301" invalidInput="invaliduser@example.com" reason="EntityDoesNotExist" />
</AppsForYourDomainErrors>

Missing or incorrect authorization token was sent


Request
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/filter
<!-- no authorization token was sent with this request -->
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="from" value="alice@gmail.com" />
  <apps:property name="hasTheWord" value="project proposal" />
  <apps:property name="shouldMarkAsRead" value="true" />
</atom:entry>
Response
HTTP/1.1 401 (Unauthorized) Unknown authorization header
Connection: Close
Content-Type: text/html; charset=UTF-8

<HTML>
<HEAD>
<TITLE>Unknown authorization header</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unknown authorization header</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

Request for invalid domain


Request
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/invaliddomain.com/johndoe/language
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="language" value="ko" />
</atom:entry>
Response
HTTP/1.1 403 (Forbidden) You are not authorized to perform operations on the domain invaliddomain.com.
<HTML>
<HEAD>
<TITLE>You are not authorized to perform operations on the domain invaliddomain.com.</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>You are not authorized to perform operations on the domain invaliddomain.com.</H1>
<H2>Error 403</H2>
</BODY>
</HTML>
or
HTTP/1.1 403 (Forbidden) Domain cannot use API
Connection: Close
Content-Type: text/html; charset=UTF-8

<HTML>
<HEAD>
<TITLE>Domain cannot use API</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Domain cannot use API</H1>
<H2>Error 403</H2>
</BODY>
</HTML>

Content-type in HTTP request is incorrect


Request
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/language
<!-- Content-Type should be "application/atom+xml" -->
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:apps="http://schemas.google.com/apps/2006">
  <apps:property name="language" value="ko" />
</atom:entry>
Response
HTTP/1.1 415 Unsupported Media Type
Connection: Close
Content-Type: text/plain; charset=UTF-8

Content-Type text/html;charset=UTF-8 is not valid.

Back to top