Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX]smtp/modules.php: Fix "Message contains more than the maximum number of recipients" on reply #1004

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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