3

I would like to send contact from contents to multiple E-Mail recipients, I checked there is no options for comma separated email address same like orders,shipping etc.

how to do that ?

Any help would be appreciated.

1 Answer 1

1

You cannot do this with Magento2 default installation. You will need to create a custom module that overrides the method sendEmail() from the \vendor\magento\module-contact\Controller\Index\Post.php:

private function sendEmail($post)
{
    $this->mail->send($post['email'], ['data' => new \Magento\Framework\DataObject($post)]);
}

As you can see by default it sends to only one email( the one you set in the admin panel). To create a custom module follow the video from here. And here is a nice tutorial about overriding classes.

2
  • The value $post['email'] has the email introduced in the contact form not the one set up in the admin panel. $post['email'] It is only used to set a replyTo in the email Commented Oct 24, 2018 at 7:59
  • you cant override a private method. Commented Jan 11, 2021 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.