Cron job

What is my mistake when i config the CRON? I want send newsletter automatically:

in the init plugin function:

    elgg_register_plugin_hook_handler('cron', 'minute', 'cronmail_cron');

and

function cronmail_cron($hook, $entity_type, $returnvalue, $params){
    $usuarios = getUsuarios();

    if(!empty($usuarios) OR !isset($usuarios)){

        foreach ($usuarios as $usuario) {

            $objetivo     = getObjetivo($usuario->guid);
            // $ideias     = getIdeiaPorObjetivo($objetivo);
            $ideias = get_entities_by_relationship_count('member', true, "", "", 0, 5, false,"",false);

            $mail = new PHPMailer;

            $mail->isSMTP();                                      // Set mailer to use SMTP
            $mail->Host = 'myhost';                    // Specify main and backup SMTP servers
            $mail->SMTPAuth = true;                               // Enable SMTP authentication
            $mail->Username = 'myuserr';              // SMTP username
            $mail->Password = 'mypass';           // SMTP password
            $mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted

            $mail->From = 'teste';
            $mail->FromName = 'teste';

            $mail->addAddress($usuario->email);  // Add a recipient

            $mail->WordWrap = 50;                                 // Set word wrap to 50 characters
            $mail->isHTML(true);                                  // Set email format to HTML

            $mail->Subject = 'teste';
            $mail->Body = utf8_decode(elgg_view('ideias', array('ideias' => $ideias))); 

            if(!$mail->send()) {
                echo "Ops... <br/>Um erro ocorreu ao enviar sua mensagem.<br/> Tente novamente mais tarde.";
                //echo 'Mailer Error: ' . $mail->ErrorInfo;
            } else {
                echo 'Obrigado por nos contatar.<br/> Você receberá uma resposta em breve!';
            }
        }
    }
}

 

That code works when i call in a action but i need it automacally. How i do it?? 

 

I read the docs:
http://docs.elgg.org/wiki/CronPlugins

http://docs.elgg.org/wiki/PluginHooks

http://docs.elgg.org/wiki/Elgg_Events