[horde] horde-alarms and SMTP auth; workaround

Jan Schneider jan at horde.org
Mon Aug 17 16:48:28 UTC 2015


Zitat von Steffen <skhorde at smail.inf.fh-bonn-rhein-sieg.de>:

> Hi,
>
> I was looking into the problem, that horde-alarms cannot send email  
> notifications, because I require SMTP auth.
>
> I found some old bug report, that it works if you configure the  
> username and password in config.php, well, obviously it does. :-)
>
> Hence, I was looking for a way to pass username & password to the  
> CLI programm.
>
> I now try this:
>
> Horde_Registry::appInit('horde', array('cli' => true, 'user_admin' => true));
>
> // set mailer params just for this CLI
> $conf['mailer']['params']['username_auth'] = false;
> $conf['mailer']['params']['password_auth'] = false;
> $conf['mailer']['params']['username'] = '<user>';
> $conf['mailer']['params']['password'] = '<password>';
>
> $alarm = $injector->getInstance('Horde_Alarm');
> $alarm->notify(null, true, false, array('notify', 'desktop'));
> foreach ($alarm->getErrors() as $error) {
>     $cli->message($error, 'cli.error');
> }
>
> ===========
>
> It works for now. Will this technique break in the neat future,  
> because some fundamental change is going to happen?

That's always possible. At least your next update with overwrite  
horde-alarms, unless you created your own copy somwhere else.

> Is there a way, to pass user/password from a CLI programm to the  
> Horde framework as if it had authentificated the "normal" way to  
> Horde?

$registry->setAuth('user', array('password' => 'pass'));

Should work.

-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the horde mailing list