本文整理汇总了PHP中OutboundEmail::createUserSystemOverrideAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP OutboundEmail::createUserSystemOverrideAccount方法的具体用法?PHP OutboundEmail::createUserSystemOverrideAccount怎么用?PHP OutboundEmail::createUserSystemOverrideAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutboundEmail
的用法示例。
在下文中一共展示了OutboundEmail::createUserSystemOverrideAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsUserAuthRequiredForOverrideAccount
function testIsUserAuthRequiredForOverrideAccount()
{
$oe = new OutboundEmail();
$GLOBALS['db']->query("DELETE FROM config WHERE category='notify' AND name='allow_default_outbound' ");
$system = $oe->getSystemMailerSettings();
//System does not require auth, no user overide account.
$system->mail_smtpauth_req = 0;
$system->save(FALSE);
$notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
$this->assertFalse($notRequired, "Test failed for determining if user auth required.");
//System does require auth, no user overide account.
$system->mail_smtpauth_req = 1;
$system->save(FALSE);
$notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
$this->assertTrue($notRequired, "Test failed for determining if user auth required.");
//System requires auth and users alloweed to use sys defaults.
$GLOBALS['db']->query("INSERT INTO config (category,name,value) VALUES ('notify','allow_default_outbound','2') ");
$notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
$this->assertFalse($notRequired, "Test failed for determining if user auth required.");
//System requires auth but user details are empty and users are not alloweed to use system details..
$GLOBALS['db']->query("DELETE FROM config WHERE category='notify' AND name='allow_default_outbound' ");
$userOverideAccont = $oe->createUserSystemOverrideAccount($this->_user->id, "", "");
$this->userOverideAccont = $userOverideAccont;
$notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
$this->assertTrue($notRequired, "Test failed for determining if user auth required.");
//User has provided all credentials.
$this->userOverideAccont->mail_smtpuser = "TEST USER NAME";
$this->userOverideAccont->mail_smtppass = "TEST PASSWORD";
$this->userOverideAccont->new_with_id = FALSE;
$this->userOverideAccont->save();
$notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
$this->assertFalse($notRequired, "Test failed for determining if user auth required.");
}
示例2: OutboundEmail
//// OUTBOUND EMAIL SAVES
///////////////////////////////////////////////////////////////////////////
$sysOutboundAccunt = new OutboundEmail();
//If a user is not alloweed to use the default system outbound account then they will be
//saving their own username/password for the system account
if (!$sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound()) {
$userOverrideOE = $sysOutboundAccunt->getUsersMailerForSystemOverride($focus->id);
if ($userOverrideOE != null) {
//User is alloweed to clear username and pass so no need to check for blanks.
$userOverrideOE->mail_smtpuser = $_REQUEST['mail_smtpuser'];
$userOverrideOE->mail_smtppass = $_REQUEST['mail_smtppass'];
$userOverrideOE->save();
} else {
//If a user name and password for the mail account is set, create the users override account.
if (!(empty($_REQUEST['mail_smtpuser']) || empty($_REQUEST['mail_smtppass']))) {
$sysOutboundAccunt->createUserSystemOverrideAccount($focus->id, $_REQUEST['mail_smtpuser'], $_REQUEST['mail_smtppass']);
}
}
}
///////////////////////////////////////////////////////////////////////////
//// INBOUND EMAIL SAVES
if (isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) {
$ie = new InboundEmail();
if (false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) {
header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=" . $return_id);
die;
// die here, else the header redirect below takes over.
}
} elseif (isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) {
// user is deleting their I-E
$ie = new InboundEmail();
示例3: array
if (is_array($v) && isset($v['name'])) {
$sigs[$k] = $v['name'];
} else {
$sigs[$k] = $v;
}
}
}
$out['signatures'] = $sigs;
$out['fromAccounts'] = $email->et->getFromAccountsArray($ie);
$out['errorArray'] = array();
$oe = new OutboundEmail();
if ($oe->doesUserOverrideAccountRequireCredentials($current_user->id)) {
$overideAccount = $oe->getUsersMailerForSystemOverride($current_user->id);
//If the user override account has not been created yet, create it for the user.
if ($overideAccount == null) {
$overideAccount = $oe->createUserSystemOverrideAccount($current_user->id);
}
$out['errorArray'] = array($overideAccount->id => $app_strings['LBL_EMAIL_WARNING_MISSING_USER_CREDS']);
}
$ret = $json->encode($out);
echo $ret;
break;
case "getSignature":
$GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: getSignature");
if (isset($_REQUEST['id'])) {
$signature = $current_user->getSignature($_REQUEST['id']);
$signature['signature_html'] = from_html($signature['signature_html']);
$out = $json->encode($signature);
echo $out;
} else {
die;