File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ class MailMessage extends DataObject
2727 */
2828 protected $ to ;
2929
30+ /**
31+ * Property with Reply-To email
32+ *
33+ * @var EmailAddress
34+ */
35+ protected $ replyTo ;
36+
3037 /**
3138 * Property with Cc email
3239 *
@@ -102,6 +109,9 @@ public function __construct(array $config)
102109 if ($ this ->from ) {
103110 $ this ->from = new EmailAddress ($ this ->from );
104111 }
112+ if ($ this ->replyTo ) {
113+ $ this ->replyTo = new EmailAddress ($ this ->replyTo );
114+ }
105115
106116 // convert recipients to Data objects.
107117 foreach (array ('to ' , 'cc ' , 'bcc ' ) as $ key ) {
@@ -135,6 +145,16 @@ public function getTo()
135145 return $ this ->to ;
136146 }
137147
148+ /**
149+ * Getting email Reply To
150+ *
151+ * @return EmailAddress
152+ */
153+ public function getReplyTo ()
154+ {
155+ return $ this ->replyTo ;
156+ }
157+
138158 /**
139159 * Getting email CC
140160 *
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ public function send(MailMessage $message)
6161 'from_email ' => $ message ->getFrom ()->getEmail (),
6262 'from_name ' => $ message ->getFrom ()->getName (),
6363 );
64+
65+ $ replyTo =$ message ->getReplyTo ();
66+ if (!empty ($ replyTo )) {
67+ $ mandrillMessage ['headers ' ]=['Reply-To ' => $ replyTo ->getEmail ()];
68+ }
6469
6570 // Recipients.
6671 $ recipients = [
@@ -71,7 +76,9 @@ public function send(MailMessage $message)
7176
7277 $ to = [];
7378 foreach ($ recipients as $ type => $ emails ) {
74- if (empty ($ emails )) continue ;
79+ if (empty ($ emails )) {
80+ continue ;
81+ }
7582 foreach ($ emails as $ email ) {
7683 $ to [] = [
7784 'email ' => $ email ->getEmail (),
@@ -85,7 +92,7 @@ public function send(MailMessage $message)
8592
8693 // Attachments.
8794 if (0 < $ message ->getAttachmentsSize () && $ message ->getAttachmentsSize () < $ this ->attachmentsSizeLimit
88- && $ attachments = $ message ->getAttachments ()
95+ && $ attachments = $ message ->getAttachments ()
8996 ) {
9097 $ attachmentsArray = [];
9198 foreach ($ attachments as $ attachment ) {
Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ public function send(MailMessage $message)
9595 $ mail ->setFrom ($ address ->getEmail (), $ address ->getName ());
9696 }
9797
98+ // Set Reply To.
99+ if ($ replyTo = $ message ->getReplyTo ()) {
100+ $ mail ->addReplyTo ($ replyTo ->getEmail (), $ replyTo ->getName ());
101+ }
102+
98103 // Recipients.
99104 if ($ to = $ message ->getTo ()) {
100105 foreach ($ to as $ address ) {
You can’t perform that action at this time.
0 commit comments