Skip to content

Commit

Permalink
[FIX]smtp/modules.php: Fix "Message contains more than the maximum nu…
Browse files Browse the repository at this point in the history
…mber of recipients" on reply
  • Loading branch information
IrAlfred authored and josaphatim committed May 28, 2024
1 parent a13e77e commit 146715a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
13 changes: 13 additions & 0 deletions modules/smtp/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,16 @@ function delete_smtp_server($smtp_server_id) {
Hm_SMTP_List::del($smtp_server_id);
}
}

if (!hm_exists('get_reply_type')) {
function get_reply_type($request) {
if (array_key_exists('reply', $request) && $request['reply']) {
return 'reply';
} elseif (array_key_exists('reply_all', $request) && $request['reply_all']) {
return 'reply_all';
} elseif (array_key_exists('forward', $request) && $request['forward']) {
return 'forward';
}
return false;
}
}
22 changes: 10 additions & 12 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public function process() {
$this->request->get['uid']
);
$reply_details = $this->session->get($cache_name, false);

if ($reply_details) {
recip_count_check($reply_details['msg_headers'], $this);
$reply_type = get_reply_type($this->request->get);
if ($reply_type == 'reply_all') {
recip_count_check($reply_details['msg_headers'], $this);
}
$this->out('reply_details', $reply_details);
}
}
Expand Down Expand Up @@ -310,21 +314,13 @@ public function process() {
}
$draft = array();
$draft_id = next_draft_key($this->session);
$reply_type = false;
if (array_key_exists('reply', $this->request->get) && $this->request->get['reply']) {
$reply_type = 'reply';
}
elseif (array_key_exists('reply_all', $this->request->get) && $this->request->get['reply_all']) {
$reply_type = 'reply_all';
}
elseif (array_key_exists('forward', $this->request->get) && $this->request->get['forward']) {
$reply_type = 'forward';
$reply_type = get_reply_type($this->request->get);
if ($reply_type == 'forward') {
$draft_id = $this->get('compose_draft_id', -1);
if ($draft_id >= 0) {
$draft = get_draft($draft_id, $this->session);
}
}
elseif (array_key_exists('draft_id', $this->request->get)) {
} elseif (array_key_exists('draft_id', $this->request->get)) {
$draft = get_draft($this->request->get['draft_id'], $this->session);
$draft_id = $this->request->get['draft_id'];
}
Expand Down Expand Up @@ -2160,9 +2156,11 @@ function default_smtp_server($user_config, $session, $request, $config, $user, $
function recip_count_check($headers, $omod) {
$headers = lc_headers($headers);
$recip_count = 0;

if (array_key_exists('to', $headers) && $headers['to']) {
$recip_count += count(process_address_fld($headers['to']));
}

if (array_key_exists('cc', $headers) && $headers['cc']) {
$recip_count += count(process_address_fld($headers['cc']));
}
Expand Down

0 comments on commit 146715a

Please sign in to comment.