Skip to content
Snippets Groups Projects
Commit 88078fcd authored by Marius Burkard's avatar Marius Burkard
Browse files

Validate mail forwarding destination

parent 54b0478f
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ $wb['limit_mailforward_txt'] = 'Die maximale Anzahl an E-Mail Weiterleitungen f
$wb['duplicate_mailbox_txt'] = 'Es existiert bereits ein E-Mail Konto mit dieser Adresse.';
$wb['domain_txt'] = 'Domain';
$wb['source_txt'] = 'Quell E-Mail Adresse';
$wb['destination_error_empty'] = 'Das Weiterleitungsziel darf nicht leer sein.';
$wb['destination_error_isemail'] = 'Das Weiterleitungsziel enthält mindestens eine ungültige E-Mail-Adresse.';
$wb['email_error_isemail'] = 'Bitte geben Sie eine gültige E-Mail Adresse an.';
$wb['send_as_txt'] = 'Senden als';
$wb['send_as_exp'] = 'Ziel erlauben, die Adresse als Absender zu nutzen (Nur, falls das Ziel intern ist)';
......
......@@ -6,6 +6,8 @@ $wb['limit_mailforward_txt'] = 'The max. number of email forwarders for your acc
$wb['duplicate_mailbox_txt'] = 'There is already a mailbox with this email address';
$wb['domain_txt'] = 'Domain';
$wb['source_txt'] = 'Source Email';
$wb['destination_error_empty'] = 'The destination must not be empty.';
$wb['destination_error_isemail'] = 'The destination contains at least one invalid email address.';
$wb['email_error_isemail'] = 'Please enter a valid email address.';
$wb['send_as_txt'] = 'Send as';
$wb['send_as_exp'] = 'Allow target to send mail using this address as origin (if target is internal)';
......
......@@ -120,6 +120,17 @@ class page_action extends tform_actions {
unset($this->dataRecord["email_local_part"]);
unset($this->dataRecord["email_domain"]);
if(trim($this->dataRecord['destination']) == '') {
$app->tform->errorMessage .= $app->tform->lng('destination_error_empty') . '<br />';
} else {
$targets = preg_split('/\s*[,;]\s*/', trim($this->dataRecord['destination']));
foreach($targets as $target) {
if(!$target || filter_var($target, FILTER_VALIDATE_EMAIL) === false) {
$app->tform->errorMessage .= $app->tform->lng('destination_error_isemail') . '<br />'
}
}
}
//* Check if there is no active mailbox with this address
$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = ?", $this->dataRecord["source"]);
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."<br>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment