Skip to content

Commit 0df5269

Browse files
author
Till Brehm
committed
Fixed: FS#3499 - fetchmail to address not updated after domainname change
1 parent 26f870e commit 0df5269

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

interface/web/mail/mail_domain_edit.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,16 @@ function onAfterUpdate() {
359359

360360
//* Update the mailinglist
361361
$app->db->query("UPDATE mail_mailinglist SET sys_userid = $client_user_id, sys_groupid = $sys_groupid WHERE domain = '".$app->db->quote($this->oldDataRecord['domain'])."'");
362-
362+
363+
//* Update fetchmail accounts
364+
$fetchmail = $app->db->queryAllRecords("SELECT * FROM mail_get WHERE destination like '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
365+
if(is_array($fetchmail)) {
366+
foreach($fetchmail as $rec) {
367+
$destination = $app->db->quote(str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['destination']));
368+
$app->db->datalogUpdate('mail_get', "destination = '$destination', sys_userid = $client_user_id, sys_groupid = '$sys_groupid'", 'mailget_id', $rec['mailget_id']);
369+
}
370+
}
371+
363372
//* Delete the old spamfilter record
364373
$tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($this->oldDataRecord["domain"])."'");
365374
$app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]);

0 commit comments

Comments
 (0)