fix #4406 【メール】メール設定で管理者メールアドレスをカンマ区切りで複数設定するとエラーになる問題を解決#4407
Merged
Conversation
Contributor
There was a problem hiding this comment.
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, | ||
| [], | ||
| [] | ||
| ); |
Collaborator
Author
|
コパイロットのメッセージは日本語でお願いします |
added 2 commits
June 4, 2026 15:31
| if($userMail) { | ||
| [$replyToUser] = $this->parseAndNormalizeMailAddresses($userMail); | ||
| if($replyToUser) { | ||
| // カンマ区切りで複数設定されていた場合先頭のアドレスをreplayToに利用 |
ryuring
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
不具合であることを前提に改修を入れています。
御確認ください