Manage user email settings in google apps for your domain.
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, );
This is the base class for the Email Settings \s-1API\s0. It is not meant to be used directly. Instead see the sub class for each version of the email settings \s-1API\s0.
The \*(C`base_url\*(C' for the Email settings \s-1API\s0 calls. For example, https://apps-apis.google.com/a/feeds/emailsettings/2.0/.
Turn on debugging output.
A VUser::Google::ApiProtocol object.
The user name of user to modify.
All of the calls to the Google \s-1API\s0 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 \s-1API\s0 docs. See the docs for the \s-1API\s0 version you are using for any differences.
Note: Values that are \*(L"true\*(R"/\*(L"false\*(R" are set using Perl values for true and false, i.e. zero for false and anything else for true.
Create a new EmailSettings object. Any read-write member may be set in the call to \*(C`new()\*(C'.
Prints $message to \s-1STDERR\s0 if \*(C`debug\*(C' is set to a true value.
Create a new label.
The label to create in Google Mail.
Create a new mail filter.
The email must come from this address in order to be filtered.
The email must be sent to this address in order to be filtered.
A string the email must have in its subject line to be filtered.
A string the email can have anywhere in it's subject or body.
A string that the email cannot have anywhere in its subject or body.
A boolean representing whether or not the email contains an attachment.
The name of the label to apply if a message matches the specified filter criteria.
Whether to automatically mark the message as read if it matches the specified filter criteria
Whether to automatically move the message to \*(L"Archived\*(R" state if it matches the specified filter criteria.
Create a gmail \*(L"Send-as alias.\*(R"
The name that will appear in the \*(L"From\*(R" field for this user.
The email address that appears as the origination address for emails sent by this user.
(Optional) If set, this address will be included as the reply-to address in emails sent using the alias.
(Optional) If set to true, this alias will be become the new default alias to send-as for this user.
Update the user's \*(L"web clip\*(R" setting.
Whether to enable showing Web clips.
Update gmail forwarding settings.
Whether to enable forwarding of incoming mail.
The email will be forwarded to this address.
What Google Mail should do with its copy of the email after forwarding it on. Allowed values: \*(L"\s-1KEEP\s0\*(R" (in inbox), \*(L"\s-1ARCHIVE\s0\*(R", or \*(L"\s-1DELETE\s0\*(R" (send to trash)
Update the user's \s-1POP3\s0 settings.
Whether to enable \s-1POP3\s0 access.
Whether to enable \s-1POP3\s0 for all mail, or mail from now on. Allowed values: \*(L"\s-1ALL_MAIL\s0\*(R", \*(L"\s-1MAIL_FROM_NOW_ON\s0\*(R"
What Google Mail should do with its copy of the email after it is retrieved using \s-1POP\s0. Allowed values: \*(L"\s-1KEEP\s0\*(R" (in inbox), \*(L"\s-1ARCHIVE\s0\*(R", or \*(L"\s-1DELETE\s0\*(R" (send to trash)
Update the user's \s-1IMAP\s0 settings.
Whether to enable \s-1IMAP\s0 access.
Update the user's vacation auto-responder.
Whether to enable the vacation responder.
The subject line of the vacation responder autoresponse.
The message body of the vacation responder autoresponse.
Whether to only send the autoresponse to known contacts.
Update the user's signature.
The signature to be appended to outgoing messages. Set the signature to '' (the empty string) to clear the signature.
Update the display language.
Google Mail's display language. This should be a language tag defined in \s-1RFC\s0 3066. See http://code.google.com/apis/apps/email_settings/developers_guide_protocol.html#GA_email_language_tags for a list of supported languages.
Update the user's general settings.
The number of conversations to be shown per page. Allowed values: 25, 50, 100
Whether to enable keyboard shortcuts.
Whether to display arrow-shaped personal indicators next to emails that were sent specifically to the user.
Whether to display snippets of messages in the inbox and when searching.
Whether to use \s-1UTF-8\s0 (unicode) encoding for all outgoing messages, instead of the default text encoding.
VUser::Google::EmailSettings::V2_0, VUser::Google::ApiProtocol
http://code.google.com/apis/apps/email_settings/developers_guide_protocol.html
Report bugs at http://code.google.com/p/vuser/issues/list.
Randy Smith, perlstalker at vuser dot net
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.