/usr/share/perl5/VUser/Google/EmailSettings.pm is in libvuser-google-api-perl 1.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | package VUser::Google::EmailSettings;
use warnings;
use strict;
# Copyright (C) 2009 Randy Smith, perlstalker at vuser dot org
our $VERSION = '0.1.0';
use Moose;
## Members
# Provisioning API
has 'user' => (is => 'rw',
required => 1,
isa => 'Str'
);
has 'google' => (is => 'rw',
isa => 'VUser::Google::ApiProtocol',
required => 1
);
has 'base_url' => (is => 'rw', isa => 'Str');
# Turn on deugging
has 'debug' => (is => 'rw', default => 0);
## Methods
sub CreateLabel {
}
sub CreateFilter {
}
sub CreateSendAsAlias {
}
sub UpdateWebClip {
}
sub UpdateForwarding {
}
sub UpdatePOP {
}
sub UpdateIMAP {
}
sub UpdateVacationResponder {
}
sub UpdateSignature {
}
sub UpdateLanguage {
}
sub UpdateGeneral {
}
## Util
#print out debugging to STDERR if debug is set
sub dprint
{
my $self = shift;
my $text = shift;
my @args = @_;
if( $self->debug and defined ($text) ) {
print STDERR sprintf ("$text\n", @args);
}
}
no Moose; # Clean up after the moose.
1;
__END__
=head1 NAME
VUser::Google::ProvisioningAPI::EmailSettings - Manage user email settings in Google Apps for Your Domain.
=head1 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' => 'sender@example.com',
'label' => 'newLabel',
'shouldArchive' => 1,
);
## Create a new send-as alias
$settings->CreateSendAsAlias(
'name' => 'Tech Support',
'address' => 'support@example.com',
);
## 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' => 'someoneelse@example.com',
'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,
);
=head1 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.
=head1 MEMBERS
=head2 Read-write members
=over
=item base_url
The C<base_url> for the Email settings API calls. For example,
I<https://apps-apis.google.com/a/feeds/emailsettings/2.0/>.
=item debug
Turn on debugging output.
=item google
A VUser::Google::ApiProtocol object.
=item user
The user name of user to modify.
=back
=head1 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.
B<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.
=head2 new (%defaults)
Create a new EmailSettings object. Any read-write member may be set in the
call to C<new()>.
=head2 dprint ($message)
Prints C<$message> to STDERR if C<debug> is set to a true value.
=head2 CreateLabel (%options)
Create a new label.
=over
=item label
The label to create in Google Mail.
=back
=head2 CreateFilter
Create a new mail filter.
=over
=item from
The email must come from this address in order to be filtered.
=item to
The email must be sent to this address in order to be filtered.
=item subject
A string the email must have in its subject line to be filtered.
=item hasTheWord
A string the email can have anywhere in it's subject or body.
=item doesNotHaveTheWord
A string that the email cannot have anywhere in its subject or body.
=item hasAttachment
A boolean representing whether or not the email contains an attachment.
=item label
The name of the label to apply if a message matches the specified filter criteria.
=item shouldMarkAsRead
Whether to automatically mark the message as read if it matches the specified filter criteria
=item shouldArchive
Whether to automatically move the message to "Archived" state if it matches the specified filter criteria.
=back
=head2 CreateSendAsAlias
Create a gmail "Send-as alias."
=over
=item name
The name that will appear in the "From" field for this user.
=item address
The email address that appears as the origination address for emails sent by this user.
=item replyTo
I<(Optional)> If set, this address will be included as the reply-to address in emails sent using the alias.
=item makeDefault
I<(Optional)> If set to true, this alias will be become the new default alias to send-as for this user.
=back
=head2 UpdateWebClip
Update the user's "web clip" setting.
=over
=item enable
Whether to enable showing Web clips.
=back
=head2 UpdateForwarding
Update gmail forwarding settings.
=over
=item enable
Whether to enable forwarding of incoming mail.
=item forwardTo
The email will be forwarded to this address.
=item action
What Google Mail should do with its copy of the email after forwarding it on.
B<Allowed values:> "KEEP" (in inbox), "ARCHIVE", or "DELETE" (send to trash)
=back
=head2 UpdatePOP
Update the user's POP3 settings.
=over
=item enable
Whether to enable POP3 access.
=item enableFor
Whether to enable POP3 for all mail, or mail from now on.
B<Allowed values:> "ALL_MAIL", "MAIL_FROM_NOW_ON"
=item action
What Google Mail should do with its copy of the email after it is retrieved using POP.
B<Allowed values:> "KEEP" (in inbox), "ARCHIVE", or "DELETE" (send to trash)
=back
=head2 UpdateIMAP
Update the user's IMAP settings.
=over
=item enable
Whether to enable IMAP access.
=back
=head2 UpdateVactionResponder
Update the user's vacation auto-responder.
=over
=item enable
Whether to enable the vacation responder.
=item subject
The subject line of the vacation responder autoresponse.
=item message
The message body of the vacation responder autoresponse.
=item contactsOnly
Whether to only send the autoresponse to known contacts.
=back
=head2 UpdateSignature
Update the user's signature.
=over
=item signature
The signature to be appended to outgoing messages. Set the signature to
C<''> (the empty string) to clear the signature.
=back
=head2 UpdateLanguage
Update the display language.
=over
=item 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.
=back
=head2 UpdateGeneral
Update the user's general settings.
=over
=item pageSize
The number of conversations to be shown per page.
B<Allowed values:> 25, 50, 100
=item shortcuts
Whether to enable keyboard shortcuts.
=item arrows
Whether to display arrow-shaped personal indicators next to emails that were sent specifically to the user.
=item snippets
Whether to display snippets of messages in the inbox and when searching.
=item unicode
Whether to use UTF-8 (unicode) encoding for all outgoing messages, instead of the default text encoding.
=back
=head1 SEE ALSO
L<VUser::Google::EmailSettings::V2_0>, L<VUser::Google::ApiProtocol>
=over 4
=item Google Email Settings API
http://code.google.com/apis/apps/email_settings/developers_guide_protocol.html
=back
=head1 BUGS
Report bugs at http://code.google.com/p/vuser/issues/list.
=head1 AUTHOR
Randy Smith, perlstalker at vuser dot net
=head1 COPYRIGHT 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.
=cut
|