NAME
REST::Google::Apps::EmailSettings - A Perl library to Google's RESTful Apps Email Settings API
SYNOPSIS
use REST::Google::Apps::EmailSettings
$google = REST::Google::Apps::EmailSettings->new(
domain => 'company.com',
username => 'admin',
password => 'g00gl34pp5!'
);
$google->enableForwarding(
username => 'jsmith',
forwardTo => 'joe@example.net'
);
DESCRIPTION
REST::Google::Apps::EmailSettings provides a Perl interface to Google's RESTful Apps API.
CONSTRUCTOR
new ( DOMAIN, USERNAME, PASSWORD )
Creates a new REST::Google::Apps::EmailSettings object. A domain parameter is required.
Supplying authentication information to the constructor is optional, but needs to happen either here or with a call to the authenticate method.
Example
$google = REST::Google::Apps::EmailSettings->new(
domain => 'company.com',
username => 'admin',
password => 'g00gl34pp5!'
);
METHODS
authenticate ( USERNAME, PASSWORD )
Authenticate a session.
Example
$google->authenticate(
username => 'admin',
password => 'g00gl34pp5!'
)
|| die "Could not authenticate";
createLabel ( USERNAME, LABEL )
Create a new label.
Example
$google->createLabel(
username => 'jsmith',
label => 'Receipts'
)
|| die "Could not create label";
createFilter ( USERNAME, CRITERIA, ACTION )
Create a new filter.
One or more of the following parameters is required to define the criteria for the filter:
- from
-
Specifies the e-mail address of the sender.
Example
from => 'j.q.public@company.com'
- to
-
Specifies the e-mail address the message was sent to.
Example
to => 'jsmith@example.net'
- subject
-
Filters for a string anywhere in the e-mail's subject line.
Example
subject => 'project'
- hasWord
-
Filters for a string anywhere in the e-mail's subject line or body.
Example
hasWord => 'work'
- noWord
-
Specifies that the e-mail cannot have a string anywhere in the subject or body.
Example
noWord => 'proposal'
- attachment
-
Can be 'true' or 'false', representing whether or not the e-mail contains an attachment
Example
attachment => 'true'
One or more of the following parameters is required to define the action to be taken when the specified criteria has been met:
- label
-
Specifies the name of the label to apply to the message. The label must already exist to be used (see the createLabel function).
Example
label => 'Receipts'
- markAsRead
-
Can be 'true' or 'false', representing whether or not to mark the message as read.
markAsRead => 'true'
- archive
-
Can be 'true' or 'false', representing whether or not to archive the message if the criteria is met.
Example
archive => 'true'
Examples
$google->createFilter(
username => 'jsmith',
hasWord => 'receipt',
label => 'Receipts'
)
|| die "Could not create filter";
$google->createFilter(
username => 'jsmith',
from => 'spam@example.net',
archive => 'true'
)
|| die "Could not create filter";
createSendAs ( USERNAME, NAME, ADDRESS, REPLYTO, DEFAULT )
Create a send-as alias.
- username
-
Required. Specified the username of the mail account.
- name
-
Required. The name that will appear in the 'from' field for this user.
- address
-
Required. The e-mail 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.
- default
-
Optional. Can be 'true' or 'false', representing whether or not this alias will be become the new default alias to send-as for this user.
Example
$google->createSendAs(
username => 'jsmith',
name => 'Sales',
address => 'sales@company.com',
default => 'true'
)
|| die "Could not create send-as alias";
enableWebClips ( USERNAME )
disableWebClips ( USERNAME )
Enable or disable web clips.
Example
$google->enableWebClips( username => 'jsmith' );
enableForwarding ( USERNAME, FORWARDTO, ACTION )
Enable forwarding.
action is an optional parameter defining what Google should do with mail once forwarding is enabled. Valid options are 'archive', 'keep' (the default), and 'delete'.
Example
$google->enableForwarding(
username => 'jsmith',
forwareTo => 'joe@example.net',
action => 'archive'
)
|| die "Could not enable forwarding";
disableForwarding ( USERNAME )
Disable forwarding.
Example
$google->disableForwarding( username => 'jsmith' );
enablePOP ( USERNAME, ENABLEFOR, ACTION )
Enable POP access.
- action
-
An optional parameter defining what Google should do with mail once POP access is enabled. Valid options are 'archive', 'keep' (the default), and 'delete'.
- enableFor
-
An optional parameter defining whether to enable POP for all mail, or mail from now on. Valid options are 'all', and 'now' (the default).
Example
$google->enablePOP(
username => 'jsmith',
enableFor => 'all',
action => 'archive'
)
|| die "Could not enable POP";
disablePOP ( USERNAME )
Disable POP access.
Example
$google->disablePOP( username => 'jsmith' );
enableIMAP ( USERNAME )
disableIMAP ( USERNAME )
Enable or disable IMAP access.
Example
$google->enableIMAP( username => 'jsmith' );
enableVacation ( USERNAME, SUBJECT, MESSAGE, CONTACTSONLY )
Enable a vacation/out-of-office auto-responder.
- subject
-
The subject line for the vacation auto-responder.
- message
-
The message body of the vacation auto-responder. Up to 100 KB is allowed.
- contactsOnly
-
Whether to only send the autoresponse to known contacts.
Example
$google->enableVacation(
username => 'jsmith',
subject => 'Out of the office',
message => 'I will be out of the office until Tuesday. Please '
. 'contact me at 555-5555 for all urgent matters.'
)
|| die "Could not enable vacation auto-responder";
disableVacation ( USERNAME )
Disable a vacation auto-responder.
Example
$google->disableVacation( username => 'jsmith' );
enableSignature ( USERNAME, SIGNATURE )
Enable an e-mail signature.
Example
$google->enableSignature(
username => 'jsmith',
signature => 'Joey Smith - (+1) 555-555-5555'
)
|| die "Could not enable signature";
disableSignature ( USERNAME )
Disable a signature.
Example
$google->disableSignature( username => 'jsmith' );
setLanguage ( USERNAME, LANGUAGE )
Updating the display language setting.
Example
$google->setLanguage(
username => 'jsmith',
language => 'de'
);
setPageSize ( USERNAME, PAGESIZE )
Set the number of conversations to be shown per page.
Example
$google->setPageSize(
username => 'jsmith',
pageSize => '50'
);
enableShortcuts ( USERNAME )
disableShortcuts ( USERNAME )
Enable or disable keyboard shortcuts.
Example
$google->enableShortcuts( username => 'jsmith' );
enableArrows ( USERNAME )
disableArrows ( USERNAME )
Enable or disable arrow-shaped personal indicators ( › and » ) next to emails that were sent specifically to the user.
Example
$google->enableArrows( username => 'jsmith' );
enableSnippets ( USERNAME )
disableSnippets ( USERNAME )
Enable or disable snippets of messages in the inbox and when searching.
Example
$google->enableSnippets( username => 'jsmith' );
AUTHOR
Scott Schneider <sschneid@gmail.com>
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 420:
Non-ASCII character seen before =encoding in '›'. Assuming UTF-8