';
} else {
$mail_format = $_POST['mail_format'];
}
if ( !isset($_POST['send_roles']) || !is_array($_POST['send_roles']) || empty($_POST['send_roles']) ) {
$err_msg = $err_msg . __('You must select at least a role.', MAILUSERS_I18N_DOMAIN) . '
';
} else {
$send_roles = $_POST['send_roles'];
}
if ( !isset( $_POST['subject'] ) || trim($_POST['subject'])=='' ) {
$err_msg = $err_msg . __('You must enter a subject.', MAILUSERS_I18N_DOMAIN) . '
';
} else {
$subject = $_POST['subject'];
}
if ( !isset( $_POST['mailContent'] ) || trim($_POST['mailContent'])=='' ) {
$err_msg = $err_msg . __('You must enter some content.', MAILUSERS_I18N_DOMAIN) . '
';
} else {
$mail_content = $_POST['mailContent'];
}
// If error, we simply show the form again
if ( $err_msg!='' ) {
// Redirect to the form page
include 'email_users_group_mail_form.php';
} else {
// No error, send the mail
// Do some HTML homework if needed
//--
if ($mail_format=='html') {
$mail_content = wpautop($mail_content);
}
?>
There was a problem trying to send email to users."; } else if (0 === $num_sent) { echo "
No email has been sent to other users. This may be because no valid email addresses were found.
"; } else if ($num_sent > 0 && $num_sent == count($recipients)){ ?>WARNING: More email has been sent than the number of recipients found.
Email has been sent to $num_sent users, but ".count($recipients)." recipients were originally found. Perhaps some users don't have valid email addresses?
"; } include 'email_users_group_mail_form.php'; } ?>