SYNOPSIS
use VUser::Google::ApiProtocol::V2_0;
use VUser::Google::EmailSettings::V2_0;
## Create a new connection
my $google = VUser::Google::ApiProtocol::V2_0->new(
domain => 'your.google-apps-domain.com',
admin => 'admin_user',
password => 'admin_user password',
);
my $settings = VUser::Google::EmailSettings::V2_0->new(
google => $google,
user => 'username',
);
## Create a new label
$settings->CreateLabel('label' => 'newLabel');
## Create a new filter
$settings->CreateFilter(
'from' => '[email protected]',
'label' => 'newLabel',
'shouldArchive' => 1,
);
## Create a new send-as alias
$settings->CreateSendAsAlias(
'name' => 'Tech Support',
'address' => '[email protected]',
);
## Update the user's web clip setting
$settings->UpdateWebClip('enable' => 0); # Turn off
$settings->UpdateWebClip('enable' => 1); # Turn on
## Update forwarding
$settings->UpdateForwarding(
'enable' => 1,
'forwardTo' => '[email protected]',
'action' => 'KEEP',
);
## Update POP3 settings
$settings->UpdatePOP(
'enable' => 1,
'enableFor' => 'MAIL_FROM_NOW_ON',
'action' => 'KEEP',
);
## Update IMAP settings
$settings->UpdateIMAP('enable' => 1);
## Update user's vacation message
$settings->UpdateVacationResponder(
'enable' => 1,
'subject' => "I'm not here right now",
'message' => "I've lost my mind and have gone to search for it.",
'contactsOnly' => 1,
);
## Update the user's signature
$settings->UpdateSignature(
'signature' => 'Joe Cool
555-5555'
);
$settings->UpdateSignature('signature' => ''); # clear sig
## Update the display language
$settings->UpdateLanguage('language' => 'en-US');
## Update the user's general settings
$settings->UpdateGeneral('pageSize' => 50);
# You can set more than one at a time
$settings->UpdateGeneral(
'arrows' => 1,
'shortcuts' => 0,
);
DESCRIPTION
This is the base class for the Email Settings API. It is not meant to be used directly. Instead see the sub class for each version of the email settings API.MEMBERS
Read-write members
- base_url
- The "base_url" for the Email settings API calls. For example, https://apps-apis.google.com/a/feeds/emailsettings/2.0/.
- debug
- Turn on debugging output.
- A VUser::Google::ApiProtocol object.
- user
- The user name of user to modify.
METHODS
All of the calls to the Google API take a hash with the options specified by Google. The keys for the hash and what is expected are listed below. Specific versions my use different keys. In general, the keys will match the names of the attributes in the API docs. See the docs for the API version you are using for any differences.Note: Values that are ``true''/``false'' are set using Perl values for true and false, i.e. zero for false and anything else for true.
new (%defaults)
Create a new EmailSettings object. Any read-write member may be set in the call to "new()".dprint ($message)
Prints $message to STDERR if "debug" is set to a true value.CreateLabel (%options)
Create a new label.- label
- The label to create in Google Mail.
CreateFilter
Create a new mail filter.- from
- The email must come from this address in order to be filtered.
- to
- The email must be sent to this address in order to be filtered.
- subject
- A string the email must have in its subject line to be filtered.
- hasTheWord
- A string the email can have anywhere in it's subject or body.
- doesNotHaveTheWord
- A string that the email cannot have anywhere in its subject or body.
- hasAttachment
- A boolean representing whether or not the email contains an attachment.
- label
- The name of the label to apply if a message matches the specified filter criteria.
- shouldMarkAsRead
- Whether to automatically mark the message as read if it matches the specified filter criteria
- shouldArchive
- Whether to automatically move the message to ``Archived'' state if it matches the specified filter criteria.
CreateSendAsAlias
Create a gmail ``Send-as alias.''- name
- The name that will appear in the ``From'' field for this user.
- address
- The email address that appears as the origination address for emails sent by this user.
- replyTo
- (Optional) If set, this address will be included as the reply-to address in emails sent using the alias.
- makeDefault
- (Optional) If set to true, this alias will be become the new default alias to send-as for this user.
UpdateWebClip
Update the user's ``web clip'' setting.- enable
- Whether to enable showing Web clips.
UpdateForwarding
Update gmail forwarding settings.- enable
- Whether to enable forwarding of incoming mail.
- forwardTo
- The email will be forwarded to this address.
- action
-
What Google Mail should do with its copy of the email after forwarding it on.
Allowed values: ``KEEP'' (in inbox), ``ARCHIVE'', or ``DELETE'' (send to trash)
UpdatePOP
Update the user's POP3 settings.- enable
- Whether to enable POP3 access.
- enableFor
-
Whether to enable POP3 for all mail, or mail from now on.
Allowed values: ``ALL_MAIL'', ``MAIL_FROM_NOW_ON''
- action
-
What Google Mail should do with its copy of the email after it is retrieved using POP.
Allowed values: ``KEEP'' (in inbox), ``ARCHIVE'', or ``DELETE'' (send to trash)
UpdateIMAP
Update the user's IMAP settings.- enable
- Whether to enable IMAP access.
UpdateVactionResponder
Update the user's vacation auto-responder.- enable
- Whether to enable the vacation responder.
- subject
- The subject line of the vacation responder autoresponse.
- message
- The message body of the vacation responder autoresponse.
- contactsOnly
- Whether to only send the autoresponse to known contacts.
UpdateSignature
Update the user's signature.- signature
- The signature to be appended to outgoing messages. Set the signature to '' (the empty string) to clear the signature.
UpdateLanguage
Update the display language.- language
- Google Mail's display language. This should be a language tag defined in RFC 3066. See http://code.google.com/apis/apps/email_settings/developers_guide_protocol.html#GA_email_language_tags for a list of supported languages.
UpdateGeneral
Update the user's general settings.- pageSize
-
The number of conversations to be shown per page.
Allowed values: 25, 50, 100
- shortcuts
- Whether to enable keyboard shortcuts.
- arrows
- Whether to display arrow-shaped personal indicators next to emails that were sent specifically to the user.
- snippets
- Whether to display snippets of messages in the inbox and when searching.
- unicode
- Whether to use UTF-8 (unicode) encoding for all outgoing messages, instead of the default text encoding.
BUGS
Report bugs at http://code.google.com/p/vuser/issues/list.AUTHOR
Randy Smith, perlstalker at vuser dot netCOPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.If you make useful modification, kindly consider emailing then to me for inclusion in a future version of this module.