function canSendPassword() { global $mod_strings, $current_user, $app_strings; require_once "modules/OutboundEmailConfiguration/OutboundEmailConfigurationPeer.php"; if ($current_user->is_admin) { $emailTemplate = new EmailTemplate(); $emailTemplate->disable_row_level_security = true; if ($emailTemplate->retrieve($GLOBALS['sugar_config']['passwordsetting']['generatepasswordtmpl']) == '') { return $mod_strings['LBL_EMAIL_TEMPLATE_MISSING']; } if (empty($emailTemplate->body) && empty($emailTemplate->body_html)) { return $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT']; } if (!OutboundEmailConfigurationPeer::validSystemMailConfigurationExists($current_user)) { return $mod_strings['ERR_SERVER_SMTP_EMPTY']; } $emailErrors = $mod_strings['ERR_EMAIL_NOT_SENT_ADMIN']; try { $config = OutboundEmailConfigurationPeer::getSystemDefaultMailConfiguration(); if ($config instanceof OutboundSmtpEmailConfiguration) { $emailErrors .= "<br>-{$mod_strings['ERR_SMTP_URL_SMTP_PORT']}"; if ($config->isAuthenticationRequired()) { $emailErrors .= "<br>-{$mod_strings['ERR_SMTP_USERNAME_SMTP_PASSWORD']}"; } } } catch (MailerException $me) { // might want to report the error } $emailErrors .= "<br>-{$mod_strings['ERR_RECIPIENT_EMAIL']}"; $emailErrors .= "<br>-{$mod_strings['ERR_SERVER_STATUS']}"; return $emailErrors; } return $mod_strings['LBL_EMAIL_NOT_SENT']; }
/** * This retrieves the System Default Outbound Mail configuration. * * @return mixed the System Default Mail Configuration. * @throws MailerException Allows MailerExceptions to bubble up. */ public static function getSystemDefaultMailer() { // get the System Default configuration that the Mailer needs $mailConfiguration = OutboundEmailConfigurationPeer::getSystemDefaultMailConfiguration(); // generate the Mailer $mailer = static::getMailer($mailConfiguration); return $mailer; }
$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']); } else { $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']); } $sugar_smarty->assign("settings", $focus->settings); if ($valid_public_key) { if (!empty($focus->settings['captcha_on'])) { $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline'); } else { $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none'); } } else { $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline'); } $sugar_smarty->assign("VALID_PUBLIC_KEY", $valid_public_key); $res = $GLOBALS['sugar_config']['passwordsetting']; $outboundMailConfig = OutboundEmailConfigurationPeer::getSystemDefaultMailConfiguration(); $smtpServerIsSet = OutboundEmailConfigurationPeer::isMailConfigurationValid($outboundMailConfig) ? "0" : "1"; $sugar_smarty->assign("SMTP_SERVER_NOT_SET", $smtpServerIsSet); $focus = BeanFactory::getBean('InboundEmail'); $focus->checkImap(); $storedOptions = unserialize(base64_decode($focus->stored_options)); $email_templates_arr = get_bean_select_array(true, 'EmailTemplate', 'name', '', 'name', true); $create_case_email_template = isset($storedOptions['create_case_email_template']) ? $storedOptions['create_case_email_template'] : ""; $TMPL_DRPDWN_LOST = get_select_options_with_id($email_templates_arr, $res['lostpasswordtmpl']); $TMPL_DRPDWN_GENERATE = get_select_options_with_id($email_templates_arr, $res['generatepasswordtmpl']); $sugar_smarty->assign("TMPL_DRPDWN_LOST", $TMPL_DRPDWN_LOST); $sugar_smarty->assign("TMPL_DRPDWN_GENERATE", $TMPL_DRPDWN_GENERATE); $LOGGED_OUT_DISPLAY = isset($res['lockoutexpiration']) && $res['lockoutexpiration'] == '0' ? 'none' : ''; $sugar_smarty->assign("LOGGED_OUT_DISPLAY_STATUS", $LOGGED_OUT_DISPLAY); $sugar_smarty->display('modules/Administration/PasswordManager.tpl');