IMP_Prefs_Identity::getFromAddress PHP Méthode

getFromAddress() public méthode

Returns the from address based on the chosen identity. If no address can be found it is built from the current user name and the specified maildomain.
public getFromAddress ( integer $ident = null ) : Horde_Mail_Rfc822_Address
$ident integer The identity to retrieve the address from.
Résultat Horde_Mail_Rfc822_Address A valid from address.
    public function getFromAddress($ident = null)
    {
        if (is_null($ident)) {
            $ident = $this->getDefault();
        }
        if (!isset($this->_cached['from'][$ident])) {
            $val = $this->getValue($this->_prefnames['from_addr'], $ident);
            if (!strlen($val)) {
                $val = $GLOBALS['registry']->getAuth();
            }
            if (!strstr($val, '@')) {
                $val .= '@' . $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create()->config->maildomain;
            }
            $ob = new Horde_Mail_Rfc822_Address($val);
            if (is_null($ob->personal)) {
                $ob->personal = $this->getFullname($ident);
            }
            $this->_cached['from'][$ident] = $ob;
        }
        return $this->_cached['from'][$ident];
    }