
#############
SystemAddress
#############


****
NAME
****


Kernel::System::SystemAddress - all system address functions


***********
DESCRIPTION
***********


Global module to add/edit/update system addresses.


****************
PUBLIC INTERFACE
****************


new()
=====


create an object


.. code-block:: perl

     my $SystemAddressObject = $Kernel::OM->Get('Kernel::System::SystemAddress');



SystemAddressAdd()
==================


add system address with attributes


.. code-block:: perl

     my $ID = $SystemAddressObject->SystemAddressAdd(
         Name     => 'info@example.com',
         Realname => 'Hotline',
         ValidID  => 1,
         QueueID  => 123,
         Comment  => 'some comment',
         UserID   => 123,
     );



SystemAddressGet()
==================


get system address with attributes


.. code-block:: perl

     my %SystemAddress = $SystemAddressObject->SystemAddressGet(
         ID => 1,
     );


returns:


.. code-block:: perl

     %SystemAddress = (
         ID         => 1,
         Name       => 'info@example.com',
         Realname   => 'Hotline',
         QueueID    => 123,
         Comment    => 'some comment',
         ValidID    => 1,
         CreateTime => '2010-11-29 11:04:04',
         ChangeTime => '2010-12-07 12:33:56',
     )



SystemAddressUpdate()
=====================


update system address with attributes


.. code-block:: perl

     $SystemAddressObject->SystemAddressUpdate(
         ID       => 1,
         Name     => 'info@example.com',
         Realname => 'Hotline',
         ValidID  => 1,
         QueueID  => 123,
         Comment  => 'some comment',
         UserID   => 123,
     );



SystemAddressList()
===================


get a list of system addresses


.. code-block:: perl

     my %List = $SystemAddressObject->SystemAddressList(
         Valid => 0,  # optional, defaults to 1
     );


returns:


.. code-block:: perl

     %List = (
         '1' => 'sales@example.com',
         '2' => 'purchasing@example.com',
         '3' => 'service@example.com',
     );



SystemAddressIsLocalAddress()
=============================


Checks if the given address is a local (system) address. Returns true
for local addresses.


.. code-block:: perl

     if ( $SystemAddressObject->SystemAddressIsLocalAddress( Address => 'info@example.com' ) ) {
         # is local
     }
     else {
         # is not local
     }



SystemAddressQueueID()
======================


find dispatching queue id of email address


.. code-block:: perl

     my $QueueID = $SystemAddressObject->SystemAddressQueueID( Address => 'info@example.com' );



SystemAddressQueueList()
========================


get a list of the queues and their system addresses IDs


.. code-block:: perl

     my %List = $SystemAddressObject->SystemAddressQueueList(
         Valid => 0,  # optional, defaults to 1
     );


returns:


.. code-block:: perl

     %List = (
         '5' => 3,
         '7' => 1,
         '9' => 2,
     );



SystemAddressLookup()
=====================


returns the ID or the name of a system address


.. code-block:: perl

     my $SystemAddressID = $SystemAddressObject->SystemAddressLookup(
         Name          => 'info@znuny.com',
         # or
         SystemAddress => 'info@znuny.com',
     );
 
     my $Name = $SystemAddressObject->SystemAddressLookup(
         ID              => 2,
         # or
         SystemAddressID => 2,
     );



NameExistsCheck()
=================


return 1 if another system address with this name already exists


.. code-block:: perl

     my $Exists = $SystemAddressObject->NameExistsCheck(
         Name => 'Some Address',
         ID   => 1,                  # optional
     );



SystemAddressIsUsed()
=====================


Return 1 if system address is used in one of the queue's or auto response's.


.. code-block:: perl

     my $SytemAddressIsUsed = $SystemAddressObject->SystemAddressIsUsed(
         SystemAddressID => 1,
     );





