MailAccount#
NAME#
Kernel::System::MailAccount - to manage mail accounts
DESCRIPTION#
All functions to manage the mail accounts.
PUBLIC INTERFACE#
new()#
Don’t use the constructor directly, use the ObjectManager instead:
my $MailAccountObject = $Kernel::OM->Get('Kernel::System::MailAccount');
MailAccountAdd()#
adds a new mail account
my $MailAccountID = $MailAccount->MailAccountAdd(
Login => 'mail',
Password => 'SomePassword',
Host => 'pop3.example.com',
Type => 'POP3',
IMAPFolder => 'Some Folder', # optional, only valid for IMAP-type accounts
ValidID => 1,
Trusted => 0,
AuthenticationType => 'oauth2_token', # optional; defaults to 'password'
OAuth2TokenConfigID => 2, # optional
DispatchingBy => 'Queue', # Queue|From
QueueID => 12,
UserID => 123,
);
Returns:
my $MailAccountID = 1;
MailAccountGetAll()#
returns an array of all mail account data
my @MailAccounts = $MailAccount->MailAccountGetAll();
Returns:
my @MailAccount = (
[
ID => 123,
Login => 'mail',
Password => 'SomePassword',
Host => 'pop3.example.com',
Type => 'POP3',
QueueID => 1,
IMAPFolder => 'Some Folder',
Trusted => 0,
Comment => 'Comment',
ValidID => 1,
AuthenticationType => 'oauth2_token',
OAuth2TokenConfigID => 2,
CreateTime => '16-04-2016 12:34:56',
ChangeTime => '16-04-2016 12:34:56',
],
[
# ...
]
);
MailAccountGet()#
returns a hash of mail account data
my %MailAccount = $MailAccount->MailAccountGet(
ID => 123,
);
Returns:
my %MailAccount = (
ID => 123,
Login => 'mail',
Password => 'SomePassword',
Host => 'pop3.example.com',
Type => 'POP3',
QueueID => 1,
IMAPFolder => 'Some Folder',
Trusted => 0,
Comment => 'Comment',
ValidID => 1,
AuthenticationType => 'oauth2_token',
OAuth2TokenConfigID => 2,
CreateTime => '16-04-2016 12:34:56',
ChangeTime => '16-04-2016 12:34:56',
);
MailAccountUpdate()#
update a new mail account
my $Success = $MailAccount->MailAccountUpdate(
ID => 1,
Login => 'mail',
Password => 'SomePassword',
Host => 'pop3.example.com',
Type => 'POP3',
IMAPFolder => 'Some Folder', # optional, only valid for IMAP-type accounts
ValidID => 1,
Trusted => 0,
AuthenticationType => 'oauth2_token', # optional; defaults to 'password'
OAuth2TokenConfigID => 2, # optional
DispatchingBy => 'Queue', # Queue|From
QueueID => 12,
UserID => 123,
);
Returns:
my $Success = 1;
MailAccountDelete()#
deletes a mail account
$MailAccount->MailAccountDelete(
ID => 123,
);
MailAccountList()#
returns a list (Key, Name) of all mail accounts
my %List = $MailAccount->MailAccountList(
Valid => 0, # just valid/all accounts
);
MailAccountBackendList()#
returns a list of usable backends
my %List = $MailAccount->MailAccountBackendList();
MailAccountFetch()#
fetch emails by using backend
my $Ok = $MailAccount->MailAccountFetch(
Login => 'mail',
Password => 'SomePassword',
Host => 'pop3.example.com',
Type => 'POP3', # POP3,POP3s,IMAP,IMAPS
Trusted => 0,
DispatchingBy => 'Queue', # Queue|From
QueueID => 12,
CMD => 1, # optional: Print additional output of MailAccount module to STDOUT
UserID => 123,
);
MailAccountCheck()#
Check inbound mail configuration
my %Check = $MailAccount->MailAccountCheck(
Login => 'mail',
Password => 'SomePassword',
Host => 'pop3.example.com',
Type => 'POP3', # POP3|POP3S|IMAP|IMAPS
Timeout => '60',
Debug => '0',
);
GetAuthenticationTypes()#
Returns the available authentication types.
my %AuthenticationTypes = $MailAccountObject->GetAuthenticationTypes();
Returns:
my %AuthenticationTypes = (
# authentication type => name
password => 'Password',
oauth2_token => 'OAuth2 token',
);