Skip to content

fix #4406 【メール】メール設定で管理者メールアドレスをカンマ区切りで複数設定するとエラーになる問題を解決#4407

Merged
katokaisya merged 4 commits into
baserproject:5.2.xfrom
katokaisya:dev-#4406
Jun 12, 2026

Conversation

@katokaisya

Copy link
Copy Markdown
Collaborator

不具合であることを前提に改修を入れています。
御確認ください

Copilot AI review requested due to automatic review settings June 4, 2026 06:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for comma-separated admin recipient addresses when sending form submissions, and verifies this behavior with a new test.

Changes:

  • Update sendFormToAdmin() to parse comma-separated admin emails into multiple recipients.
  • Trim parsed admin emails (and use trimmed “from” in sendFormToUser()).
  • Add a PHPUnit test covering multiple admin recipients.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
plugins/bc-mail/tests/TestCase/Mailer/MailMessageMailerTest.php Adds a test asserting multiple recipients are set when admin mail is comma-separated.
plugins/bc-mail/src/Mailer/MailMessageMailer.php Implements parsing/normalization for comma-separated admin emails and uses parsed value in setTo().

Comment on lines 52 to 62
if (strpos($adminMail, ',') !== false) {
[$fromAdmin] = explode(',', $adminMail);
$adminMails = array_map('trim', explode(',', $adminMail));
$adminMails = array_values(array_filter($adminMails, static fn($mail) => $mail !== ''));
$fromAdmin = $adminMails[0] ?? $adminMail;
$toAdmin = $adminMails;
} else {
$fromAdmin = $adminMail;
$toAdmin = $adminMail;
}
$data['other']['mode'] = 'admin';
$this->setTo($adminMail)
$this->setTo($toAdmin)
->setFrom($fromAdmin, $this->getFrom($mailContent))
Comment on lines 107 to 111
if (strpos($adminMail, ',') !== false) {
[$fromAdmin] = explode(',', $adminMail);
[$fromAdmin] = array_map('trim', explode(',', $adminMail));
} else {
$fromAdmin = $adminMail;
}
Comment on lines +108 to +115
$this->MailMessageMailer->sendFormToAdmin(
$mailContent,
'abc@example.com,def@example.com',
'abcUser@example.com',
$data,
[],
[]
);
@katokaisya

Copy link
Copy Markdown
Collaborator Author

コパイロットのメッセージは日本語でお願いします

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

if($userMail) {
[$replyToUser] = $this->parseAndNormalizeMailAddresses($userMail);
if($replyToUser) {
// カンマ区切りで複数設定されていた場合先頭のアドレスをreplayToに利用
@katokaisya katokaisya merged commit 7f02f14 into baserproject:5.2.x Jun 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants