src/Classes/AdldapExchange.php
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = null)
    {
        $this->adldap->utilities()->validateNotNull('Distinguished Name [dn]', $distinguishedName);
        $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress);

        if ($mailNickname !== null) {
            // Find the dn of the user
            $user = $this->adldap->contact()->info($distinguishedName, ['cn', 'displayname']);

            if ($user[0]['displayname'] === null) {
                return false;
            }

            $mailNickname = $user[0]['displayname'][0];
        }

        $attributes = ['email' => $emailAddress,'contact_email' => 'SMTP:'.$emailAddress,'exchange_proxyaddress' => 'SMTP:'.$emailAddress,'exchange_mailnickname' => $mailNickname];

        // Translate the update to the LDAP schema
        $mod = $this->adldap->ldapSchema($attributes);

        // Check to see if this is an enabled status update
        if (!$mod) {
            return false;
        }

        // Do the update
        return $this->connection->modify($distinguishedName, $mod);
    }
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = null)
    {
        $this->adldap->utilities()->validateNotNull('Distinguished Name [dn]', $distinguishedName);
        $this->adldap->utilities()->validateNotNull('Email Address', $emailAddress);

        if ($mailNickname !== null) {
            // Find the dn of the user
            $user = $this->adldap->contact()->info($distinguishedName, ['cn', 'displayname']);

            if ($user[0]['displayname'] === null) {
                return false;
            }

            $mailNickname = $user[0]['displayname'][0];
        }

        $attributes = ['email' => $emailAddress,'contact_email' => 'SMTP:'.$emailAddress,'exchange_proxyaddress' => 'SMTP:'.$emailAddress,'exchange_mailnickname' => $mailNickname];

        // Translate the update to the LDAP schema
        $mod = $this->adldap->ldapSchema($attributes);

        // Check to see if this is an enabled status update
        if (!$mod) {
            return false;
        }

        // Do the update
        return $this->connection->modify($distinguishedName, $mod);
    }
public function contactMailEnable ( $ distinguishedName , $ emailAddress , $ mailNickname = null ) { $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Distinguished Name [dn]' , $ distinguishedName ) ; $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Email Address' , $ emailAddress ) ; if ( $ mailNickname !== null ) { // Find the dn of the user $ user = $ this -> adldap -> contact ( ) -> info ( $ distinguishedName , [ 'cn' , 'displayname' ] ) ; if ( $ user [ 0 ] [ 'displayname' ] === null ) { return false ; } $ mailNickname = $ user [ 0 ] [ 'displayname' ] [ 0 ] ; } $ attributes = [ 'email' => $ emailAddress , 'contact_email' => 'SMTP:' . $ emailAddress , 'exchange_proxyaddress' => 'SMTP:' . $ emailAddress , 'exchange_mailnickname' => $ mailNickname ] ; // Translate the update to the LDAP schema $ mod = $ this -> adldap -> ldapSchema ( $ attributes ) ; // Check to see if this is an enabled status update if ( ! $ mod ) { return false ; } // Do the update return $ this -> connection -> modify ( $ distinguishedName , $ mod ) ; }
Mail enable a contact
Allows email to be sent to them through Exchange.

@param string $distinguishedName The contact to mail enable
@param string $emailAddress      The email address to allow emails to be sent through
@param string $mailNickname      The mailnickname for the contact in Exchange.  If NULL this will be set to the display name

@return bool
Mail enable a contact Allows email to be sent to them through Exchange .