Google Code offered in: English - Español - 日本語 - 한국어 - Português - Pусский - 中文(简体) - 中文(繁體)
|
Setup
Email Settings API Overview
API Operations API Authentication Email Settings API HTTP format XML Request Format XML Responses API Limits and Quotas Manage Labels Manage Filters Manage Send-as Alias Manage Web Clips |
Manage Forwarding Manage POP Settings Manage IMAP Settings Manage Vacation-Responder |
Manage Signatures Manage Language Settings Manage Delegation Settings New!
Adding a Gmail Delegate
Retrieving All Gmail Delegates Deleting a Gmail Delegate Delegation Examples Manage General Settings Errors |
Google Apps allows Google administrators to offer their users co-branded versions of a variety of personalized Google applications, such as Google mail.
This document describes the Email Settings API which enables Google partners to programmatically manipulate most user-level Google Mail settings.
The Email Settings API supports the following operations:
To use the Email Settings API, you need to send an HTTP request to a specific URL that represents a particular user's setting. The request will be one of three types—either a POST request that performs a create operation, for creating new labels, filters, or send-as aliases—or a PUT request that performs an update operation, for changing any of the updatable settings listed above—or a GET request that retrieves all the settings for labels, forwarding, and many others as listed above. Only the Gmail delegation Delete operation is currently supported.
The body of the PUT or the POST requests will contain XML that describes either the entity to be created, or the new values that the settings should take. A GET request does not have a body of additional XML elements. Google will verify that all requests contain valid XML, include all required data fields, and meet the authentication requirements given below.
All of your API requests must be sent over HTTPS. Each API request that you send needs to contain an authentication token, which Google will use to authorize access to the operation specified in the API request.
If your client is a standalone single-user "installed" client (such as a desktop application), then you should use the ClientLogin Interface system; if your client is a multi-user web application client, then you should use the 3-legged OAuth. Both of these methods involve interacting with an authentication service. The authentication service returns an authentication token that your client can then send to the Email Settings API service along with every subsequent request on behalf of that user.
For clients using ClientLogin and have been enrolled in two-step verification, use your two-step verification access code for the Passwd query parameter.
For more information about authentication with Google Data APIs in general, see the authentication documentation.
Most of the examples in subsequent sections of this document assume you are providing the appropriate authentication.
The ClientLogin Interface provides additional information about programmatically logging users into their accounts.
To obtain an authentication token, submit an HTTP POST request to the following URL:
https://www.google.com/accounts/ClientLogin
The following guidelines apply to the request:
The POST body needs to include a string in the following format:
&Email=<email_address>&Passwd=<password>&accountType=HOSTED&service=apps
You will need to make the following changes to this string:
Replace the string <email_address> with the email address for your admin account.
Replace the string <password> with the password for that account or the access code if the account is enrolled in two-step verification.
The email address and password values must be URL-encoded. For example, the URL-encoded form of the email address apps.test.account@example.com is apps%2Etest%2Eaccount%40example%2Ecom.
The POST request must specify the value application/x-www-form-urlencoded for the Content-Type header.
Google will return a response containing your authentication token in response to your POST request. The authentication token will be the Auth value on that page, and you need to extract the token from the page. When you submit an API request, you must set the Content-type and Authorization headers as shown in the example below.
Content-type: application/atom+xml
Authorization: GoogleLogin auth=your-authentication-token
Note: Authentication tokens expire after 24 hours. As such, you will need to submit a request to the above URL at least once every 24 hours. We recommend that you keep the token in memory rather than writing it to a file.
Email Settings API also supports 3-legged OAuth scheme for allowing web applications to manage email settings for user mail accounts. The OAuth guide provides more information on how to obtain access tokens
https://apps-apis.google.com/a/feeds/emailsettings/2.0/
In order to change a user's settings with the Email Settings API, the administrator must make an HTTP request (either a POST, PUT, or a GET) to a certain URL, and when appropriate, with an XML atom entry in the body of the request. The following sections explain the format of the request URL as well as the concept of an XML atom entry; however, for each setting you want to change, consult the specific section in this document for the exact properties to set.
The first step to changing a user's settings with the Email Settings API is to find the URL for the setting you plan to change, and whether it is accessed with a create request (a POST,) or an update request (a PUT), or a retrieve data request (a GET).
The example below shows the format URLs take in the Email Settings API. This particular example adds a new Google Mail filter for a user in your domain. Variables are highlighted in bold, blue text.
https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain}/{username}/{settingID}
The following variables should be filled in to complete the request:
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
The second step is to find the format that the XML body of the request must take for POST and PUT requests. The XML document is a Google Data Atom entry. The <entry> must contain at least one <apps:property> tag. Each <apps:property> tag has a name and a value attribute which describe how the email settings are to be changed— such as describing a filter to be created, or the new values that forwarding settings should take.
The following XML example describes a fairly straightforward filter that will archive every email from the example.com domain with project 1 in the subject header.
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:apps='http://schemas.example.com/apps/2006'>
<apps:property name='from' value='example.com'/>
<apps:property name='subject' value='project 1'/>
<apps:property name='shouldArchive' value='true'/>
</atom:entry>
This example does not show all of the possibilities for creating filters, or explain how to change any of the other settings. The following sections explain in full details the required XML format for each settings operation.
If the filter was created sucessfully, the Email Settings API will return an HTTP 201 or 200 response indicating a successful creation. The body of the response will echo back the create, update, or data retrieval request.
However, if there was an error due to an invalid API request, an HTTP error response is returned. The list of possible HTTP response codes are listed at http://code.google.com/apis/gdata/reference.html#http-status-codes.
If there was an error that occurred during the creation of the filter, an XML error response is returned. The list of possible XML response codes are listed at http://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_reference.html#google_apps_tag_error.
The following is an example of an error that occurred during the creation of a filter:
400 BAD REQUEST
<?xml version="1.0" encoding="UTF-8"?>
<AppsForYourDomainErrors>
<error errorCode="1301" reason="EntityDoesNotExist"
invalidInput="your-invalid-input"/>
</AppsForYourDomainErrors>
Limits and quotas protect the Google infrastructure from an automated process that uses the Email Settings API in an inappropriate way. Excessive requests from an API might result from a harmless typo, or may result from an inefficiently designed system that makes needless API calls. Regardless of the cause, blocking traffic from a specific source once it reaches a certain level is necessary for the overall health of the Google Apps system. It ensures that one developer's actions cannot negatively impact the larger community.
In the unlikely event that your API request fails, you'll receive an HTTP status code response. A status code of 403 has error information about incorrect input, and an HTTP status code of 503 has error information indicating which API quotas have been exceeded. These responses allow your custom application to detect these errors and take appropriate action.
If your requests need to be completed in a fixed period of time, send your requests in parallel or use multiple threads in your Java or C# application. An example of parallel requests is requesting small batches of emails from different users rather than adding or removing lots of emails from one user simultaneously. In the case of threads, try starting with 10 threads, one thread per user email. Note, the thread recommendation has trade-offs and is not useful for all API situations. If the number of requests gets too high, quota errors will occur. Another trade-off example is the Email Settings API's quota for the maximum overall message upload rate. The upload rate is one API request - per second - per user, no matter how many threads are making upload requests.
For all errors that are time based (maximum of N things for N seconds per thread), especially the 503 status code errors, we recommend your code catch the exception and, using an exponential backoff algorithm, wait for a small delay before retrying the failed call. An Email Settings API example for one thread is to wait 5 seconds and retry the failed call. If the request is successful, repeat this pattern for the other threads. If the second request is not successful, your application should scale back on the frequency of the request until a call is successful. For example, increase the initial 5 second delay to 10 seconds and retry your failed call again. Also, decide on a retry limit. For example retry a request 5 to 7 times with different delay times before your application returns an error to the user.
| API Limit Categories | Limits |
|---|---|
| Email settings, for a new account | If you are changing the settings for a recently provisioned account, you should wait at least one second before making your API calls. This insures that the email account is fully provisioned and activated before any attempt is made to change a user's email settings. |
| Email settings, for a new delegate | Depending on the network, there could be a delay of a minute or less before a new delegate is added. We recommend a delay between the creation of more than one delegate or between the retrieval of newly created delegates. |
| Language settings | It may take several hours for new language settings to be applied. |
| API Quota Categories | Quotas |
| ClientLogin authentication tokens | Valid for 24 hours. The error is '401 token expired' |
| Error messages | To see some common errors, along with the output produced to help diagnose them, see the common errors section of this guide. |
| Delegation, max delegates per user | Each user delegating Gmail access is allowed a maximum of 25 delegates. |
| Filter, the forwardTo action | A filter's forwardTo field must hold a validated email address or an error is returned. You can create an unlimited number of filters, but, only 20 filters can forward to other addresses. |
| Filter, settings | A filter name can be any HTML encoded string up to 225 characters.
Filter values are case insensitive. For example, HelpDesk@example.com is filtered the same as helpdesk@example.com. Filters can use Boolean operators. See Boolean operators. Note: When specifying the subject or words for a filter to match, many non-alphanumeric characters cannot be used. These include square brackets( [ ] ), parentheses ( ), currency symbols, the ampersand ( & ), pound sign ( # ), and the asterisk ( * ). |
| Filter, the Subject setting | A filter's Subject field can be any HTML encoded string up to 1000 characters. |
| Forwarding, in a non-active account | Changes to forwarding settings are only made active once the user agrees to Google's terms of service. Attempting to change the forwarding settings before the user agrees to the terms of service will result in the updated settings being stored, but not made active. Once the user agrees to the terms, then the stored settings will be made active. This prevents users from using the forwarding feature until they have agreed to the terms, but does not prevent administrators from changing the forwarding settings before the user's account has been made active. |
| Forwarding, valid email address | An email address used in the Forwarding setting must be valid. A valid value of forwardTo is an email address that has been already verified to be used as a forwarding address in the email account, or one that fulfills one of the following criteria:
If the value of forwardTo doesn't adhere to one of these rules, setting up of forwarding using the API will fail. Note: Forwarding and updating settings are not active until the user has agreed to the account's terms of service. Although an administrator can change these properties at any time, the changed settings will be stored and will not take effect until the user has agreed to the account's terms of service. |
| Label settings | Email has a 225 character limit per label.
There is no limit to the number of emails assigned to a label. Label names must not conflict with reserved label names in any language for which Google Mail is available. In English, these include inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv. Note: The caret character (^) is not allowed in a label string. |
| Language settings | The Language settings suppors the RFC 3066 standard format, for example en-GB, fr, or ja for British English, French, or Japanese.
|
| Page size setting | The possible number of conversations to be shown per page are 25, 50 or 100. |
| POP3 and IMAP, in a non-active account | Changes to POP and IMAP settings are only made active once the user agrees to Google's terms of service. Attempting to change these settings before the user agrees to the terms of service will result in the updated settings being stored, but not made active. Once the user agrees to the terms, then the stored settings will be made active. This prevents users from using the POP and IMAP features until they have agreed to the terms, but does not prevent administrators from changing these settings before the user's account has been made active. |
| POP3 and IMAP settings | These settings are not active until the user has agreed to the account's terms of service. Although an administrator can change these properties at any time, the changed settings will be stored and will not take effect until the user has agreed to the account's terms of service. |
| 'Send-As' alias setting, size of alias' name | An email 'Send-As' alias name can be any HTML encoded string up to 250 characters. |
| 'Send-As' alias setting, verified | The verified property shows if the ownership of the email address's domain has been verified. This property must be true (verified), before the Send-As alias address can work.
|
| Signature setting and retrieving | When setting an email signature, the plain text string can be up to 2000 characters. An empty string ("") results in no signature, meaning the signature feature is disabled. When setting or retrieving a signature, the API accepts plain or HTML-encoded strings. |
| Vacation-responder setting | The vacation-responder's subject setting can be any HTML encoded string up to 500 characters.
The responder's message body can be any HTML encoded string up to 100KB of characters. Note: If a contact sends you several messages during a vacation period, the responder's automated reply is sent at most once every 4 days. |
| Other Types of Limits | Limitations and Guidelines |
|---|---|
| abuse@example.com and postmaster@example.com | For email in general, Google monitors the postmaster and abuse addresses for problems with your account. Since abuse and postmaster are reserved aliases, you can not use them as usernames, nicknames, or email aliases. See reporting abuse. |
| Client libraries | For the Java client library, use Java 1.5 or later. For a .NET client, use the .NET 1.1 runtime or later, and you should be current with all patches. |
| Email, administrator's recovery address | The Admin Settings API manages your domain administrator's email recovery address. For recovery address details, see recovery email address. |
| Email, maximum recipients per email | When using your email and outside of the Email Settings API, the maximum number of recipients allowed for each email is 500 recipients.
If you use a POP or IMAP mail client (Microsoft Outlook or Apple Mail, e.g.), the maximum number of recipients for one message is 100 people at a time. For external recipients, Google will temporarily disable an account for approximately 24 hours if the message being sent is going to more than 500 external recipients per day from a Standard Edition account, or 2000 external recipients per day from a Premier Edition or Education Edition account. This includes the recipients in the message's To:, Cc:, and Bcc: fields. See the help center's sending limits article. In addition, an account is disabled if the there is a large number of undeliverable messages. For a large number of undeliverable messages, verify your contacts' email addresses and confirm everyone you are sending email are willing to receive it. See the Bulk Senders Guidelines. |
| Email, MX records and mail flow | The Admin Settings API verifies your MX record status. This confirms that your email domain's MX records have been configured and your account has mail flow. |
| Email, SSO settings | The Admin Settings API lets you control how users access the email by adjusting the Single Sign-On (SSO) settings. |
| Email client, report settings | The Reporting API generates an email clients report showing how users in your domain access their hosted accounts on a day-to-day basis. For each day, the report lists the total number of accounts in your domain as well as the number of users in your domain who have access email using WebMail. |
| External content, viewing default | When you receive an email with an externally linked image, the default is for the images not to be displayed. In addition, the default behavior will display the image if the email's sender is someone you have sent an email message at least twice. See display images. |
| Group email permission settings | The Provisioning API manages a new group's subscription permissions. |
| HTTPS, default | The default browser setting is HTTPS.
Note:Possible errors may result when using this setting. See changing HTTPS. |
| Mailbox, language and domain logo settings | The Admin Settings API lets you set the default language for your users' accounts, and the API lets you personalize your mailbox by changing your domain logo. |
| Mail loops | A mail loop often occurs when two accounts are forwarding to each other. When a mail loop is detected, the email system will bounce the message to break the cycle. |
| Outbound email routing | The Admin Settings API configures outbound routing of email from users in your domain. |
| POP and IMAP supported clients | Supported POP client list
Supported IMAP client list Outside of the Email Settings and when using IMAP email client connections, the limit of simultaneous IMAP connections is 10 connections per account. Mail clients can open multiple connections in the background. It is possible to reach a connection quota simply by using only two mail clients accessing the same account at the same time. If you commonly use multiple mail clients or mobile devices with the same email account, close or sign out of any mail clients you are not actively using. |
| User names | Usernames can contain letters (a-z), numbers (0-9), dashers (-), underscores (_), and apostrophes ('). Google Apps recognizes dots or periods (.). This is not the same as Gmail. |
Creating labels in Google Mail is accomplished with a POST request to the following URL:
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/label
The following table shows the only property to be set when creating a label.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| label | name="label" | value="Important" | The label to create in Google Mail | (any HTML encoded string up to 225 characters- note that the '^' character is not allowed) |
Retrieving all labels and their settings in Google Mail is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/label
Note: The retrieved labels do not include the reserved label names such as inbox, unread, drafts, sent, chat, muted, spam, trash, popped, and contactcsv.
Deleting a Gmail label is accomplished with a DELETE request to the following URL:
DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/label/{label name}
Note: Label names must use URL encoding, replacing spaces with "+". For more information, see Percent-encoding.
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/label
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="label" value="status updates" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.createLabel(users, "status updates");
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.CreateLabel(username='ben', name='status updates')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.CreateLabel("ben", "status updates");
<atom:feed xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label</atom:id>
<atom:updated>2010-03-17T15:29:21.064Z</atom:updated>
<atom:link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label'/>
<atom:link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label'/>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label'/>
<openSearch:startIndex>1</openSearch:startIndex>
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/domain/example.com/venu/label/id1</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id1'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id1'/>
<apps:property name='labelId' value='id1'/>
<apps:property name='label' value='VenuLabel'/>
<apps:property name='unreadCount' value='20'/>
<apps:property name='visibility' value='SHOW'/>
</atom:entry>
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id2</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id2'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/label/id2'/>
<apps:property name='labelId' value='id2'/>
<apps:property name='label' value='testLabel'/>
<apps:property name='unreadCount' value='0'/>
<apps:property name='visibility' value='HIDE'/>
</atom:entry>
</atom:feed>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveLabel("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveLabels(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedFeed labels = service.RetrieveLabels("venu");
DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/label/status+updates
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.DeleteLabel(username='ben', label='status updates')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.DeleteLabel("ben", "status updates");
Creating a Google Mail filter is accomplished with a POST request to the following URL:
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/filter
The following two tables shows the properties to be set when creating a filter. The first table shows what you can filter on, the second what action you can take, and their corresponding XML attributes. At least one property from the first table and one from the second table must be set.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| From | name="from" | value="jane@example.com" | The email must come from this address in order to be filtered. | (a valid email address up to 400 characters) |
| To | name="to" | value="bob@example.com" | The email must be sent to this address in order to be filtered. | (a valid email address up to 400 characters) |
| Subject | name="subject" | value="project" | A string the email must have in its subject line to be filtered. | (any HTML encoded string up to 1000 characters*) |
| Has the words | name="hasTheWord" | value="work" | A string the email can have anywhere in it's subject or body. | (any HTML encoded string up to 1000 characters*) |
| Doesn't have | name="doesNotHaveTheWord" | value="proposal" | A string that the email cannot have anywhere in its subject or body. | (any HTML encoded string up to 1000 characters*) |
| Has attachment | name="hasAttachment" | value="true" | A boolean representing whether or not the email contains an attachment. | "true" or "false" |
Note: when specifying the subjects or the words for the filter to match, many non-alphanumeric characters cannot be used. Disallowed characters include square brackets, parentheses, currency symbols, the ampersand, the pound sign and asterisks.
| 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" |
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/filter
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="from" value="alice@gmail.com" />
<apps:property name="hasTheWord" value="project proposal" />
<apps:property name="shouldMarkAsRead" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.createFilter(users,
"alice@gmail.com", // from
"", // to
"", // subject
"project proposal", // hasTheWord
"", // doesNotHaveTheWord
false, // hasAttachment
true, // shouldMarkAsRead
false, // shouldArchive
""); // label
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.CreateFilter(username='liz', from_address='alice@gmail.com', has_the_word='project proposal', mark_as_read=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.createFilter("liz", // target user
"alice@gmail.com", // from
"", // to
"", // subject
"project proposal", // hasTheWords
"", // doesNotHaveTheWords
"false", // hasAttachment
"", // label
"true", // shouldMarkAsRead
"false"); // shouldArchive
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/filter
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="to" value="announcements@example.com" />
<apps:property name="label" value="announcements" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.createFilter(users,
"", // from
"announcements@example.com", // to
"", // subject
"", // hasTheWord
"", // doesNotHaveTheWord
false, // hasAttachment
false, // shouldMarkAsRead
false, // shouldArchive
"announcements"); // label
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.CreateFilter(username='ben', to_address='announcements@example.com', label='announcements')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.createFilter("ben", // target user
"", // from
"announcements@example.com", // to
"", // subject
"", // hasTheWords
"", // doesNotHaveTheWords
"false", // hasAttachment
"announcements", // label
"false", // shouldMarkAsRead
"false"); // shouldArchive
Creating a Google Mail send-as alias is accomplished with a POST request to the following URL:
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/sendas
The following table shows the properties to be set when creating a send-as Alias.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| name | name="name" | value="Network Support" | The name that will appear in the "From" field for this user. | Any HTML encoded string up to 250 characters. |
| address | name="address" | value="support@example.com" | The email address that appears as the origination address for emails sent by this user. | Any email address which exists as a user or an alias on the hosted domain. |
| replyTo | name="replyTo" | value="liz@example.net" | (Optional) If set, this address will be included as the reply-to address in emails sent using the alias. | Any valid email address. |
| makeDefault | name="makeDefault" | value="true" | (Optional) If set to true, this alias will be become the new default alias to send-as for this user. | "true" or "false" |
Retrieving all Google Mail Send-As alias settings is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/sendas
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/sendas
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="name" value="Sales" />
<apps:property name="address" value="sales@example.com" />
<apps:property name="makeDefault" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.createSendAs(users,
"Sales", // name
"sales@example.com", // address
"", // replyTo
true); // makeDefault
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.CreateSendAs(username='liz', name='Sales', address='sales@example.com', make_default=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.CreateSendAs("liz", "Sales", "sales@example.com", "", "true");
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/sendas
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="name" value="Support" />
<apps:property name="address" value="support@example.com" />
<apps:property name="replyTo" value="b.smith@gmail.com" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.createSendAs(users,
"Support", // name
"support@example.com", // address
"b.smith@gmail.com", // replyTo
false); // makeDefault
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.CreateSendAs(username='ben', name='Support', address='support@example.com', reply_to='b.smith@gmail.com')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.CreateSendAs("ben", "Support", "support@example.com", "b.smith@gmail.com", "false");
<atom:feed xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas</atom:id>
<atom:updated>2010-03-17T15:29:21.064Z</atom:updated>
<atom:link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas'/>
<atom:link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas'/>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas'/>
<openSearch:startIndex>1</openSearch:startIndex>/id1
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id1</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id1'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id1'/>
<apps:property name='sendAsId' value='id1'/>
<apps:property name='address' value='ankur@example.com'/>
<apps:property name='name' value='ankur'/>
<apps:property name='replyTo' value='replyto@example.com'/>
<apps:property name='isDefault' value='true'/>
<apps:property name='verified' value='true'/>
</atom:entry>
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id2</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id2'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/sendas/id2'/>
<apps:property name='sendAsId' value='id2'/>
<apps:property name='address' value='namrata@example.com'/>
<apps:property name='name' value='namrata'/>
<apps:property name='replyTo' value='replyto@example.com'/>
<apps:property name='isDefault' value='true'/>
<apps:property name='verified' value='true'/>
</atom:entry>
</atom:feed>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveSendAs("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveSendAs(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedFeed sendas = service.RetrieveSendAs("venu");
Updating Google Mail web clip settings is accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/webclip
The following table shows the only property to be set when updating web clip settings.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| enable | name="enable" | value="true" | Whether to enable showing Web clips. | "true" or "false" |
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/webclip
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
</atom:entry>
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateWebclip(username='ben', enable=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateWebclip("ben", "true");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/webclip
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateWebclip(username='ben', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateWebclip("ben", "false");
Updating Google Mail Forwarding settings is accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/forwarding
Note: Although an administrator can change these properties at any time, the changed settings will only take effect once the user has agreed to the terms of service.
The following table shows the properties to be set when updating forwarding settings. Note that all properties are required to enable forwarding settings (but setting enable to false is enough to disable).
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| enable | name="enable" | value="true" | Whether to enable forwarding of incoming mail. | "true" or "false" |
| forwardTo | name="forwardTo" | value="fred@example.com" | The email will be forwarded to this address. | A valid email address — see note below |
| action | name="action" | value="KEEP" | What Google Mail should do with its copy of the email after forwarding it on. | "KEEP" (in inbox), "ARCHIVE", or "DELETE" (send to spam), or "MARK_READ" (marked as read) |
Note: A valid value of forwardTo is an email address that has been already verified to be used as a forwarding address in the Google Mail account, or one that fulfills one of the following criteria:
1. It belongs to the same domain,
2. It belongs to a subdomain of the same domain, or
3. It belongs to a domain alias configured as part of the same Google Apps account.
If the value of forwardTo doesn't adhere to one of these rules, setting up forwarding via the API will fail.
Retrieving Google Mail forwarding settings is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/forwarding
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/forwarding
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="forwardTo" value="alice@example.net" />
<apps:property name="action" value="KEEP" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeForwarding(users,
true, // enable
"alice@example.com", // forwardTo
"KEEP"); // action
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateForwarding(username='liz', enable=True, forward_to='alice@example.net', action='KEEP')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateForwarding("liz", "true", "alice@example.net", "KEEP");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/forwarding
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="forwardTo" value="b.smith@example.com" />
<apps:property name="action" value="ARCHIVE" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeForwarding(users,
true, // enable
"b.smith@example.com", // forwardTo
"ARCHIVE"); // action
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateForwarding(username='ben', enable=True, forward_to='b.smith@example.com', action='ARCHIVE')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateForwarding("ben", "true", "b.smith@example.com", "ARCHIVE");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/forwarding
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeForwarding(users,
false, // enable
"", // forwardTo
""); // action
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateForwarding(username='liz', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateForwarding("liz", "false", null, null);
The domain name is example.com and the user name is venu.
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/forwarding</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/forwarding'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/forwarding'/>
<apps:property name='enable' value='true'/>
<apps:property name='forwardTo' value='venu@example.com'/>
<apps:property name='action' value='DELETE'/>
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveForwarding("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveForwarding(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedEntry forwarding = service.RetrieveForwarding("venu");
Updating Google Mail POP settings is accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/pop
Note: Although an administrator can change these properties at any time, the changed settings will only take effect once the user has agreed to the terms of service.
The following table shows the properties to be set when updating POP settings. Note that all properties are required to enable POP settings (but setting enable to false is enough to disable).
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| enable | name="enable" | value="true" | Whether to enable POP access. | "true" or "false" |
| enableFor | name="enableFor" | value="ALL_MAIL" | Whether to enable POP for all mail, or mail from now on. | "ALL_MAIL", "MAIL_FROM_NOW_ON" |
| action | name="action" | value="KEEP" | What Google Mail should do with its copy of the email after it is retrieved using POP. | "KEEP" (in inbox), "ARCHIVE", or "DELETE" (send to trash) |
Retrieving Google Mail POP settings is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/pop
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/pop
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="enableFor" value="MAIL_FROM_NOW_ON" />
<apps:property name="action" value="KEEP" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changePop(users,
true, // enable
"MAIL_FROM_NOW_ON", // enableFor
"KEEP"); // action
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdatePop(username='liz', enable=True, enable_for='MAIL_FROM_NOW_ON', action='KEEP')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdatePop("liz", "true", "MAIL_FROM_NOW_ON", "KEEP");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/pop
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
<apps:property name="enableFor" value="ALL_MAIL" />
<apps:property name="action" value="DELETE" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changePop(users,
true, // enable
"ALL_MAIL", // enableFor
"DELETE"); // action
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdatePop(username='ben', enable=True, enable_for='ALL_MAIL', action='DELETE')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdatePop("ben", "true", "ALL_MAIL", "DELETE");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/pop
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changePop(users,
false, // enable
"", // enableFor
""); // action
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdatePop(username='liz', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdatePop("liz", "false", null, null);
The domain name is example.com and the user name is venu.
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/pop</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/pop'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/pop'/>
<apps:property name='enable' value='true'/>
<apps:property name='action' value='ARCHIVE'/>
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrievePop("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrievePop(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedEntry pop = service.RetrievePop("venu");
Updating Google Mail IMAP settings is accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{use name}/imap
Note: Although an administrator can change these properties at any time, the changed settings will only take effect once the user has agreed to the terms of service.
The following table shows the only property to be set when updating IMAP settings.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| enable | name="enable" | value="true" | Whether to enable IMAP access. | "true" or "false" |
Retrieving Google Mail IMAP settings is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/imap
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/imap
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeImap(users, true); // enable
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateImap(username='ben', enable=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateImap("ben", "true");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/ben/imap
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeImap(users, false); // enable
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateImap(username='ben', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateImap("ben", "false");
The domain name is example.com and the user name is venu.
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/imap</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/imap'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/imap'/>
<apps:property name='enable' value='true'/>
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveImap("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveImap(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedEntry imap = service.RetrieveImap("venu");
Updating Google Mail vacation-responder settings is accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/vacation
The following table shows the properties to be set when updating Vacation-responder settings.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| contactsOnly | name="contactsOnly" | value="true" | Whether to only send the autoresponse to known contacts. | "true" or "false" |
| domainOnly | name="domainOnly" | value="true" | Whether to only send the autoresponse to users in the same primary domain as the user taking the vacation. | "true" or "false" The default is "false". |
| enable | name="enable" | value="true" | Whether to enable the vacation-responder. | "true" or "false" |
| endDate | name="endDate" | value="2011-06-23" | The last day until which vacation responder is enabled for the user. In this version of the API, the endDate is the UTC timezone, not the user's timezone. Also see the startDate property. | "YYYY-MM-DD" |
| message | name="message" | value="I won'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 Google Mail vacation-responder settings is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/vacation
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's urgent you can contact me on 555-5555." />
<apps:property name="contactsOnly" value="true" />
<apps:property name="domainOnly" value="false" />
<apps:property name="startDate" value="2011-06-20" />
<apps:property name="endDate" value="2011-06-23" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("ben");
service.changeVacation(users,
true, // enable
"Out of office", // subject
"If it's urgent you can contact me on 555-5555.", // message
true); // contactOnly
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateVacation(username='ben', enable=True, subject='Out of office', message="If it's urgent you can contact me on 555-5555.", contacts_only=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateVacation("ben", "true", "Out of office", "If it's urgent you can contact me on 555-5555.", "true");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/vacation
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="enable" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeVacation(users,
false, // enable
"", // subject
"", // message
false); // contactOnly
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateVacation(username='liz', enable=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateVacation("liz", "false", null, null, null);
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/vacation</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/vacation'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/vacation'/>
<apps:property name='enable' value='true'/>
<apps:property name='subject' value='Vacation today'/>
<apps:property name='message' value='This is my vacation-responder message'/>
<apps:property name='contactsOnly' value='true'/>
<apps:property name='domainOnly' value='false'/>
<apps:property name='startDate' value='2011-06-20'/>
<apps:property name='endDate' value='2011-06-23'/>
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveVacation("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveVacation(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedEntry vacation = service.RetrieveVacation("venu");
Updating the Google Mail signature is accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/signature
The following table shows the only property to be set when updating the signature.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| signature | name="signature" | value="Regards, Joe." |
The signature to be appended to outgoing messages.
|
When setting a signature, the API accepts a plain text string up to 2000 characters. The API supports setting and retrieving HTML-encoded signatures. For no signature, set the property to the empty string (""). |
Retrieving a Google Mail signature setting is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/signature
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&Z LTD." />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeSignature(users,
"Liz Jones - (+1) 619-555-5555" +
"Accounts Management, A&Z LTD."); // signature
import gdata.apps.emailsettings.client
...
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain')
client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps')
client.UpdateSignature(username='liz', signature="Liz Jones - (+1) 619-555-5555" +
"Accounts Management, A&Z LTD.")
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateSignature("liz", "Liz Jones - (+1) 619-555-5555" +
"Accounts Management, A&Z LTD.");
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/signature
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="signature" value="" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeSignature(user, ""); // signature
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateSignature(username='liz', signature='')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("yourdomain", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateSignature("liz", "");
The domain name is example.com and the user name is venu.
<atom:entry>
<atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/signature</atom:id>
<atom:updated>2009-04-17T15:29:21.064Z</atom:updated>
<atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/signature'/>
<atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/signature'/>
<apps:property name='signature' value='Regards from Venu at the help desk'/>
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveSignature("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveSignature(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedEntry signature = service.RetrieveSignature("venu");
Updating the display language setting in Google Mail can be accomplished with a PUT request to the following URL:
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name}/language
The following table shows the only property to be set when updating the display language.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| language | name="language" | value="en-US" | Google Mail's display language | Language Tag according to RFC 3066, for any language that Google Mail supports. e.g. "en-GB", "fr" or "ja" for British English, French, or Japanese See complete list below. |
Note: It may take several hours for new language settings to be applied.
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/language
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="language" value="de" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeLanguage(users, "de"); // language
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateLanguage(username='liz', language='de')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateLanguage("liz", "de");
| 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 | हिन्दी | hi |
| 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 | മലയാളം | ml |
| 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 |
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:
A Gmail delegate:
Users in your account will not see or use delegation updates until the account's delegation feature is enabled. To enable the delegation feature in the control panel, select Email in the Service settings tab. And on the General settings page, enable Mail Delegation.
Once delegation is enabled, an API administrator grants a delegate access to a delegator's mailbox. This is different from the user interface where, once delegation is enabled, users grant access for their own mailboxes.
Tip: Establish an account policy for how and when delegates are added to a user's mailbox. By setting user expectations, a clear delegation policy helps manage your account maintenance overhead and mitigates user confusion.
Creating a Gmail delegate is accomplished with a POST request to the following URL:
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name of delegator}/delegation
When a new delegate is created, there may be a minute or less delay before the new delegate is available. We recommend your client application has a delay between the creation of more than one delegate or between the retrieval of a newly created delegate.
The following table shows the URI arguments used when creating a Gmail delegate.
| Name | Example value | Description |
|---|---|---|
| domain name | example.com | A primary domain name |
| user name of the delegator | liz | The name used in the primary email address. or a user alias of the user granting access. This is the delegator. No delegation notification is sent to the delegate when a delegation assignment has been added. |
Note: For multiple domain accounts, an API administrator can not grant Gmail access if the delegator and delegate users belong to different domains.
The following table shows the properties to be set when creating a delegate.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| address | address="email address" | value="liz@example.com" | The name of the user given access to a Gmail account. A delegate can read, send, and delete messages on the behalf of the user who owns the Gmail account (the delegator). | A primary email address or an alias. The API allows a maximum of 25 delegates for each delegator. |
Note: If transitioning to the new infrastructure for Google Apps accounts, both the the domain used by the delegate and the primary account's domain have to have been transitioned before making an API delegation request.
Retrieving all Gmail delegates for a specific delegator is accomplished with a GET request to the following URL:
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name of delegator}/delegation
Note: The mail delegation feature must be enabled before retrieving delegates. For more information, see Adding a Gmail Delegate.
The following table shows the response's delegate status propery.
| Name | XML attribute | Example XML value | Description | Possible values |
|---|---|---|---|---|
| status | status="status setting" | status="ACCEPTED" | The status of the delegated access. | ACCEPTED -- Status when the delegate has access to the delegator's mailbox. If a delegate has been added using the API, this is the default status. PENDING -- Status if a delegate has been added by the delegator using the user interface, the delegate's access is in pending state until the delegate confirms the access given to him. REJECTED -- Status if a delegate has been added by the delegator in the user interface, and delegate has rejected the access given to him. |
Deleting a Gmail delegate is accomplished with a DELETE request to the following URL:
DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain name}/{user name of delegator}/
delegation/{email ID of delegate}
Note: Delegates with PENDING or REJECTED status can not be deleted using the API. And, the mail delegation feature must be enabled before deleting a delegate. For more information, see Adding a Gmail Delegate.
address, is ankur@example.com.
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/delegation/ <?xml version="1.0" encoding="utf-8"?> <atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006"> <apps:property name="address" value="ankur@example.com" /> </atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.addEmailDelegate("liz", "ankur@example.com");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.AddEmailDelegate(username='liz', address='ankur@example.com')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedEntry entry = service.CreateDelegate("liz", "ankur@example.com");
address, is ankur@example.com. This delegate was added using the user interface.
address is piyush@example.com. This delegate either was added using the user interface or the API.
GET https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/
Response for this example
<atom:entry> <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/</atom:id> <atom:updated>2009-04-17T15:29:21.064Z</atom:updated> <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/ example.com/venu/delegation/'/> <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/ example.com/venu/delegation/'/> <apps:property name='delegationId' value='ankur@example.com'/> <apps:property name='delegate' value='ankur'/> <apps:property name='address' value='ankur@example.com'/> <apps:property name='status' value='PENDING'/> </atom:entry>
<atom:entry> <atom:id>https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/</atom:id> <atom:updated>2009-04-17T15:29:21.064Z</atom:updated> <atom:link rel='self' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/ example.com/venu/delegation/'/> <atom:link rel='edit' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/emailsettings/2.0/ example.com/venu/delegation/'/> <apps:property name='delegationId' value='piyush@example.com'/> <apps:property name='delegate' value='piyush'/> <apps:property name='address' value='piyush@example.com'/> <apps:property name='status' value='ACCEPTED'/> </atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.retrieveEmailDelegates("venu");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.RetrieveEmailDelegates(username='venu')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
AppsExtendedFeed delegates = service.RetrieveDelegates("venu");
DELETE https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/venu/delegation/piyush@example.com
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "example.com", "adminUsername", "adminPassword");
service.deleteEmailDelegate("venu", "piyush@example.com");
client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='example.com') ... client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.DeleteEmailDelegate(username='venu', address='piyush@example.com')
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.DeleteDelegate("venu", "piyush@example.com");
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" |
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/general
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="pageSize" value="25" />
<apps:property name="arrows" value="true" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeGeneral(users,
"25", // pageSize
false, // shortcuts
true, // arrows
false, // snippets
false); // unicode
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateGeneralSettings(username='liz', page_size=25, arrows=True)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateGeneralSettings("liz", // target user
"25", // pageSize
"false", // shortcuts
"true", // arrows
"false", // snippets
"false"); // unicode
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/liz/general
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="shortcuts" value="false" />
</atom:entry>
import sample.appsforyourdomain.gmailsettings.GmailSettingsService;
...
GmailSettingsService service = new GmailSettingsService("your-apps", "yourdomain", "adminUsername", "adminPassword");
List users=new ArrayList();
users.add("liz");
service.changeGeneral(users,
"25", // pageSize
true, // shortcuts
false, // arrows
false, // snippets
false); // unicode
import gdata.apps.emailsettings.client ... client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='yourdomain') client.ClientLogin(email='adminUsername@yourdomain', password='adminPassword', source='your-apps') client.UpdateGeneralSettings(username='liz', shortcuts=False)
using Google.GData.Apps;
using Google.GData.Apps.GoogleMailSettings;
using Google.GData.Client;
using Google.GData.Extensions;
...
GoogleMailSettingsService service = new GoogleMailSettingsService("example.com", "your-apps");
service.setUserCredentials("adminUsername", "adminPassword");
service.UpdateGeneralSettings("liz", // target user
"25", // pageSize
"true", // shortcuts
"false", // arrows
"false", // snippets
"false"); // unicode
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>
ResponseHTTP/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>
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>
ResponseHTTP/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>
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>
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 Invalid request URI.
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>
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 Invalid request URI.
PUT https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/language
<!-- missing XML. -->
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 Premature end of file.
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>
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 Required field missing: enable
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>
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 Required field missing: name
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>
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 Must be at most 225 characters: label
POST https://apps-apis.google.com/a/feeds/emailsettings/2.0/example.com/johndoe/filter
<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="from" value="alice@gmail.com" />
<apps:property name="hasTheWord" value="project proposal" />
<aapps:property name="shouldMarkAsRead" value="true" />
</atom:entry>
ResponseHTTP/1.1 400 Bad Request Connection: Close Content-Type: text/plain; charset=UTF-8 The prefix "aapps" for element "aapps:property" is not bound.
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>
ResponseHTTP/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>
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>
ResponseHTTP/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>
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>
ResponseHTTP/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>
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>
ResponseHTTP/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.