|
|
@@ -101,7 +101,7 @@ class Message implements JsonSerializable, Serializable
|
|
|
protected $sender = [];
|
|
|
|
|
|
/**
|
|
|
- * The email the recipient will reply to
|
|
|
+ * List of email's that the recipient will reply to
|
|
|
*
|
|
|
* @var array
|
|
|
*/
|
|
|
@@ -381,7 +381,7 @@ class Message implements JsonSerializable, Serializable
|
|
|
*/
|
|
|
public function setReplyTo($email, ?string $name = null)
|
|
|
{
|
|
|
- return $this->setEmailSingle('replyTo', $email, $name, 'Reply-To requires only 1 email address.');
|
|
|
+ return $this->setEmail('replyTo', $email, $name);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -395,6 +395,19 @@ class Message implements JsonSerializable, Serializable
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Add "Reply-To" address.
|
|
|
+ *
|
|
|
+ * @param string|array $email Null to get, String with email,
|
|
|
+ * Array with email as key, name as value or email as value (without name)
|
|
|
+ * @param string|null $name Name
|
|
|
+ * @return $this
|
|
|
+ */
|
|
|
+ public function addReplyTo($email, ?string $name = null)
|
|
|
+ {
|
|
|
+ return $this->addEmail('replyTo', $email, $name);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Sets Read Receipt (Disposition-Notification-To header).
|
|
|
*
|
|
|
* @param string|array $email String with email,
|
|
|
@@ -878,10 +891,18 @@ class Message implements JsonSerializable, Serializable
|
|
|
'replyTo' => 'Reply-To',
|
|
|
'readReceipt' => 'Disposition-Notification-To',
|
|
|
'returnPath' => 'Return-Path',
|
|
|
+ 'to' => 'To',
|
|
|
+ 'cc' => 'Cc',
|
|
|
+ 'bcc' => 'Bcc',
|
|
|
];
|
|
|
+ $headersMultipleEmails = ['to', 'cc', 'bcc', 'replyTo'];
|
|
|
foreach ($relation as $var => $header) {
|
|
|
if ($include[$var]) {
|
|
|
- $headers[$header] = (string)current($this->formatAddress($this->{$var}));
|
|
|
+ if (in_array($var, $headersMultipleEmails)) {
|
|
|
+ $headers[$header] = implode(', ', $this->formatAddress($this->{$var}));
|
|
|
+ } else {
|
|
|
+ $headers[$header] = (string)current($this->formatAddress($this->{$var}));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if ($include['sender']) {
|
|
|
@@ -892,12 +913,6 @@ class Message implements JsonSerializable, Serializable
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- foreach (['to', 'cc', 'bcc'] as $var) {
|
|
|
- if ($include[$var]) {
|
|
|
- $headers[ucfirst($var)] = implode(', ', $this->formatAddress($this->{$var}));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
$headers += $this->headers;
|
|
|
if (!isset($headers['Date'])) {
|
|
|
$headers['Date'] = date(DATE_RFC2822);
|