@@ -34,10 +34,13 @@ public function getRepository(): MessageRepository
3434
3535 public function processMessage (array $ data ): bool
3636 {
37+ $ subject = $ this ->config ['contact ' ]['subject ' ] ?? $ this ->config ['dot_mail ' ]['message_options ' ]['subject ' ]
38+ ?: $ this ->config ['application ' ]['name ' ] . ' Contact ' ;
39+
3740 $ message = new Message (
3841 $ data ['email ' ],
3942 $ data ['name ' ],
40- $ data [ ' subject ' ] ,
43+ $ subject ,
4144 $ data ['message ' ],
4245 Message::PLATFORM_WEBSITE
4346 );
@@ -57,18 +60,28 @@ public function sendContactMail(Message $message): bool
5760 );
5861
5962 $ this ->mailService ->setSubject ($ message ->getSubject ());
60- $ this ->mailService ->getMessage ()->addFrom (
61- $ this ->config ['dot_mail ' ]['default ' ]['message_options ' ]['from ' ],
62- $ this ->config ['dot_mail ' ]['default ' ]['message_options ' ]['from_name ' ]
63+
64+ $ messageConfig = $ this ->config ['dot_mail ' ]['default ' ]['message_options ' ];
65+ $ contactSender = $ this ->config ['contact ' ]['message_sender ' ];
66+ $ contactRecipients = $ this ->config ['contact ' ]['message_recipients ' ];
67+
68+ $ this ->mailService ->getMessage ()->setFrom (
69+ $ contactSender ['from_email ' ] ?: $ messageConfig ['from ' ],
70+ $ contactSender ['from_name ' ] ?: $ messageConfig ['from_name ' ]
6371 );
64- $ this ->mailService ->getMessage ()->addTo (
65- $ this ->config ['contact ' ]['message_receivers ' ]['to ' ],
66- 'Dotkernel Team '
72+
73+ $ this ->mailService ->getMessage ()->setTo (
74+ $ contactRecipients ['to ' ] ?: $ messageConfig ['to ' ],
75+ $ contactRecipients ['name ' ] ?: null
6776 );
68- $ this ->mailService ->getMessage ()->addCC (
69- $ this ->config ['contact ' ]['message_receivers ' ]['cc ' ],
70- 'Dotkernel Team '
77+
78+ $ this ->mailService ->getMessage ()->setCc (
79+ $ contactRecipients ['cc ' ] ?: $ messageConfig ['cc ' ],
80+ $ contactRecipients ['name ' ] ?: null
7181 );
82+
83+ $ this ->mailService ->getMessage ()->setBcc ($ contactRecipients ['bcc ' ] ?: $ messageConfig ['bcc ' ]);
84+
7285 $ this ->mailService ->getMessage ()->setReplyTo ($ message ->getEmail (), $ message ->getName ());
7386
7487 return $ this ->mailService ->send ()->isValid ();
0 commit comments