Admin SDK

Google Apps Email Settings API

Google Apps allows website 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 users 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.

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.

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.

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

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. 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 with a status code.

If there was an error that occurred during the creation of the filter, an XML error response is returned. To understand how to handle possible XML response codes see http://developers.google.com/admin-sdk/provisioning/#methods_for_handling_errors.

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>

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}/{username}/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}/{username}/label

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}

Label Examples

Example 1, Creating a label

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

Protocol

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>

Java

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");

Python

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')

.NET

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 username 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.

Protocol

  <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>
  

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveLabel("venu");
  

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveLabels(username='venu')

.NET

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.

Protocol

DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/label/status+updates

Python

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')

.NET

ass="prettyprint"> 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");

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}/{username}/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"
  • 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 username 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.

Protocol

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>

Java

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

Python

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)

.NET

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.

Protocol

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>

Java

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

Python

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')

.NET

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

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}/{username}/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}/{username}/sendas

Send-as Alias Examples

Example 1, Creating a Send-as alias

  • The username 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.

Protocol

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>

Java

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

Python

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)

.NET

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.

Protocol

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>

Java

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

Python

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')

.NET

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 username 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.

Protocol

  <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>
  

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveSendAs("venu");

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveSendAs(username='venu')

.NET

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");

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}/{username}/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 username is ben.
  • Web clip service is to be enabled.

Protocol

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>

Python

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)

.NET

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.

Protocol

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>

Python

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)

.NET

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");

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}/{username}/forwarding

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)

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}/{username}/forwarding

Forwarding Settings Examples

Example 1, forwarding all emails

  • The username 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.

Protocol

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>

Java

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

Python

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')

.NET

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 username 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.

Protocol

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>

Java

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
                         "b.smith@example.com", // forwardTo
                         "ARCHIVE");          // action

Python

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')

.NET

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 username is liz.
  • Emails are no longer to be forwarded to another address.

Protocol

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>

Java

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

Python

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)

.NET

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 username 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.

Protocol

   <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>
  

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveForwarding("venu");
  

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveForwarding(username='venu')
  

.NET

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");

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}/{username}/pop

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}/{username}/pop

POP Settings Examples

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

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

Protocol

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>

Java

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

Python

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')

.NET

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 username 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).

Protocol

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>

Java

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

Python

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");

.NET

Example 3, POP access is disabled

  • The username is liz.
  • POP access is to be disabled.

Protocol

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>

Java

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

Python

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)

.NET

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 username 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.

Protocol

   <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>
  

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrievePop("venu");
  

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrievePop(username='venu')
  

.NET

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");

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}/{username}/imap

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

Name XML attribute Example XML value Description
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}/{username}/imap

IMAP Settings Examples

Example 1, enabling IMAP access

  • The username is ben.
  • IMAP access is to be enabled.

Protocol

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>

Java

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

Python

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)

.NET

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 username is ben.
  • IMAP access is to be disabled.

Protocol

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>

Java

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

Python

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)

.NET

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 username is venu.

Protocol

   <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>
  

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveImap("venu");
  

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveImap(username='venu')
  

.NET

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");

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}/{username}/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'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}/{username}/vacation

Vacation-Responder Settings Examples

Example 1, vacation-responder enabled and autoreply to contacts

  • The username 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.

Protocol

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>

Java

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

Python

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)

.NET

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 username is liz.
  • The vacation-responder is to be disabled.

Protocol

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>

Java

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

Python

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)

.NET

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 username is venu.
  • When the 'enable' property is 'true', the response returns the vacation request's startDate, endDate, and domainOnly properties.

Protocol

   <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>
   

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveVacation("venu");
   

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveVacation(username='venu')
   

.NET

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");

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}/{username}/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 10000 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}/{username}/signature

Signature Examples

Example 1, setting signature and contact details

  • The username 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.

Protocol

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>

Java

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

Python

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.")

.NET

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 username is liz.
  • Her signature is to be disabled.

Protocol

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>

Java

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

Python

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='')

.NET

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 username is venu.

Protocol

   <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>
  

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveSignature("venu");
  

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveSignature(username='venu')
  

.NET

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");

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}/{username}/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).

Language Examples

Example 1

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

Protocol

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

Java

Python

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')

.NET

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
Catalan Català ca
Chinese (Simplified) 中文(简体) zh-CN
Chinese (Traditional) 中文(繁體) zh-TW
Croatian Hrvatski hr
Czech Český cs
Danish Dansk da
Dutch Nederlands nl
English (United States) English (US) en-US
English (United Kingdom) English (UK) en-GB
Estonian Eesti keel et
Finnish Suomi fi
French Français fr
German Deutsch de
Greek Ελληνικά el
Gujarati ગુજરાતી gu
Hebrew עברית iw
Hindi हिन्दी h i
Hungarian Magyar hu
Icelandic Íslenska is
Indonesian Bahasa Indonesia in
Italian Italiano it
Japanese 日本語 ja
Kannada ಕನ್ನಡ kn
Korean 한국어 ko
Latvian Latviešu lv
Lithuanian Lietuvių lt
Malay Bahasa Melayu ms
Malayalam മലയാളം m l
Marathi मराठी mr
Norwegian Norsk (Bokmål) no
Oriya ଓଡିଆ (Oriya) or
Persian فارسی fa
Polish Polski pl
Portuguese (Brazil) Português (Brasil) pt-BR
Portuguese (Portugal) Português (Portugal) pt-PT
Romanian Română ro
Russian Русский ru
Serbian Српски sr
Slovak Slovenský sk
Slovenian Slovenščina sl
Spanish Español es
Swedish Svenska sv
Tagalog Filipino tl
Tamil தமிழ் ta
Telugu తెలుగు te
Thai ภาษาไทย th
Turkish Türkçe tr
Ukrainian Українська uk
Urdu اردو ur
Vietnamese Tiếng Việt vi

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 Admin console, or, using the Directory 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 Admin console:

  1. Select Google Apps.
  2. In the Services list, select Gmail.
  3. On the Gmail settings page, select User settings.
  4. On the User settings page, in the End User Settings group, select the Mail Delegation checkbox.

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}/{username 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
username 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.

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.

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}/{username of delegator}/delegation

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}/{username of delegator}/delegation/{email ID of 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.

Protocol

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>

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.addEmailDelegate("liz", "ankur@example.com");

Python

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')

.NET

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.

Protocol

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>

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveEmailDelegates("venu");

Python

client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com')
...

client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.RetrieveEmailDelegates(username='venu')

.NET

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 username of the user who granted access (the delegator) is venu.
  • The email address of the delegate being deleted is piyush@example.com.

Protocol

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

Java

import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...

GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.deleteEmailDelegate("venu", "piyush@example.com");

Python

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')

.NET

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");

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.

Protocol

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>

Java

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

Python

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)

.NET

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.

Protocol

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>

Java

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

Python

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)

.NET

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

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" />
<apps: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.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.