Skip to content

Commit 95ed0d3

Browse files
committed
Fixed: FS#959 - Changeing email alias
1 parent e2ce435 commit 95ed0d3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

interface/web/mail/mail_user_edit.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,20 @@ function onAfterUpdate() {
303303
$app->db->query($sql);
304304
}
305305

306+
//** If the email address has been changed, change it in all aliases too
307+
if($this->oldDataRecord['email'] != $this->dataRecord['email']) {
308+
309+
//* Update the aliases
310+
$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE destination = '".$app->db->quote($this->oldDataRecord['email'])."'");
311+
if(is_array($forwardings)) {
312+
foreach($forwardings as $rec) {
313+
$destination = $app->db->quote($this->dataRecord['email']);
314+
$app->db->datalogUpdate('mail_forwarding', "destination = '$destination'", 'forwarding_id', $rec['forwarding_id']);
315+
}
316+
}
317+
318+
} // end if email addess changed
319+
306320
}
307321

308322
}

0 commit comments

Comments
 (0)