Sending mail credentials to email [edit form]

This commit is contained in:
dpeca 2017-04-14 14:50:15 +02:00
commit 9347c2aa04
4 changed files with 57 additions and 1 deletions

View file

@ -179,8 +179,17 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco
exit();
}
// Validate email
if ((!empty($_POST['v_send_email'])) && (empty($_SESSION['error_msg']))) {
if (!filter_var($_POST['v_send_email'], FILTER_VALIDATE_EMAIL)) {
$_SESSION['error_msg'] = __('Please enter valid email address.');
}
}
$v_domain = escapeshellarg($_POST['v_domain']);
$v_account = escapeshellarg($_POST['v_account']);
$v_send_email = $_POST['v_send_email'];
$v_credentials = $_POST['v_credentials'];
// Change password
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
@ -297,6 +306,16 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco
}
}
// Email login credentials
if ((!empty($v_send_email)) && (empty($_SESSION['error_msg']))) {
$to = $v_send_email;
$subject = __("Email Credentials");
$hostname = exec('hostname');
$from = __('MAIL_FROM', $hostname);
$mailtext = $v_credentials;
send_email($to, $subject, $mailtext, $from);
}
// Set success message
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');