method addAccount documentation in bbn\User\Email
function(array $cfg)
{
if (!X::hasProps($cfg, ['login', 'pass', 'type'], true)) {
throw new \Exception("Missing arguments");
}
if (!($id_accounts = self::getOptionId('accounts'))) {
throw new \Exception("Impossible to find the account option");
}
// toGroup as this option will use different user options
if (!($id_pref = $this->pref->addToGroup(
$id_accounts,
[
'id_user' => $this->user->getId(),
'login' => $cfg['login'],
'type' => $cfg['type'],
'host' => $cfg['host'] ?? null,
'port' => $cfg['port'] ?? null,
'ssl' => $cfg['ssl'] ?? true
]
))
) {
throw new \Exception("Impossible to add the preference");
}
if (!$this->_get_password()->userStore($cfg['pass'], $id_pref, $this->user)) {
throw new \Exception("Impossible to set the password");
}
$this->getAccount($id_pref, true);
if (!empty($cfg['folders'])) {
$this->syncFolders($id_pref, $cfg['folders']);
}
return $id_pref;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions