function sendExpiryNotification( $user )
    {
        $userToSendEmail = $user;
        $receiver = $userToSendEmail->attribute( 'email' );

        $mail = new eZMail();
        if ( !$mail->validate( $receiver ) )
        {
            eZDebug::writeError( 'Invalid email address set in user ' . $user->attribute( 'contentobject_id' ), 'sendExpiryNotification' );
            return false;
        }
        $tpl = eZTemplate::factory();
        $tpl->setVariable( 'user', $userToSendEmail );

        $http = eZHTTPTool::instance();
        $http->UseFullUrl = false;

        $templateResult = $tpl->fetch( 'design:userpaex/expirynotificationmail.tpl' );

        $ini = eZINI::instance();
        $emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
        if ( !$emailSender )
            $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' );

        $mail->setSender( $emailSender );
        $mail->setReceiver( $receiver );

        $subject = ezpI18n::tr( 'mbpaex/userpaex', 'Your password is about to expire' );
        if ( $tpl->hasVariable( 'subject' ) )
            $subject = $tpl->variable( 'subject' );

        $mail->setSubject( $subject );
        $mail->setBody( $templateResult );

        return eZMailTransport::send( $mail );
    }
function sendExpiryNotification( $user )
    {
        $userToSendEmail = $user;
        $receiver = $userToSendEmail->attribute( 'email' );

        $mail = new eZMail();
        if ( !$mail->validate( $receiver ) )
        {
            eZDebug::writeError( 'Invalid email address set in user ' . $user->attribute( 'contentobject_id' ), 'sendExpiryNotification' );
            return false;
        }
        $tpl = eZTemplate::factory();
        $tpl->setVariable( 'user', $userToSendEmail );

        $http = eZHTTPTool::instance();
        $http->UseFullUrl = false;

        $templateResult = $tpl->fetch( 'design:userpaex/expirynotificationmail.tpl' );

        $ini = eZINI::instance();
        $emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
        if ( !$emailSender )
            $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' );

        $mail->setSender( $emailSender );
        $mail->setReceiver( $receiver );

        $subject = ezpI18n::tr( 'mbpaex/userpaex', 'Your password is about to expire' );
        if ( $tpl->hasVariable( 'subject' ) )
            $subject = $tpl->variable( 'subject' );

        $mail->setSubject( $subject );
        $mail->setBody( $templateResult );

        return eZMailTransport::send( $mail );
    }
function sendExpiryNotification ( $ user ) { $ userToSendEmail = $ user ; $ receiver = $ userToSendEmail -> attribute ( 'email' ) ; $ mail = new eZMail ( ) ; if ( ! $ mail -> validate ( $ receiver ) ) { eZDebug :: writeError ( 'Invalid email address set in user ' . $ user -> attribute ( 'contentobject_id' ) , 'sendExpiryNotification' ) ; return false ; } $ tpl = eZTemplate :: factory ( ) ; $ tpl -> setVariable ( 'user' , $ userToSendEmail ) ; $ http = eZHTTPTool :: instance ( ) ; $ http -> UseFullUrl = false ; $ templateResult = $ tpl -> fetch ( 'design:userpaex/expirynotificationmail.tpl' ) ; $ ini = eZINI :: instance ( ) ; $ emailSender = $ ini -> variable ( 'MailSettings' , 'EmailSender' ) ; if ( ! $ emailSender ) $ emailSender = $ ini -> variable ( 'MailSettings' , 'AdminEmail' ) ; $ mail -> setSender ( $ emailSender ) ; $ mail -> setReceiver ( $ receiver ) ; $ subject = ezpI18n :: tr ( 'mbpaex/userpaex' , 'Your password is about to expire' ) ; if ( $ tpl -> hasVariable ( 'subject' ) ) $ subject = $ tpl -> variable ( 'subject' ) ; $ mail -> setSubject ( $ subject ) ; $ mail -> setBody ( $ templateResult ) ; return eZMailTransport :: send ( $ mail ) ; }
Send password expiry notification to user

@param eZUser $user ezuser object that contains the destination email address
@return true if notification sent correctly, false if not.
Send password expiry notification to user