sashas777 / bug-from-email

Fix for Magento 2.2.4 GitHub Issue #14952 (https://github.com/magento/magento2/issues/14952)
35 stars 16 forks source link

2.2.8 - Sender Name #17

Open trucatchtraps opened 5 years ago

trucatchtraps commented 5 years ago

Hi, I just installed Magento 2.2.8 and there is a small issue with this extension. When the confirmation emails are being sent, they are not using the "Sender Name" but instead using the "Sender Email". Please advise a fix please. Thanks!

sashas777 commented 5 years ago

I not sure what causes it. So far some people confirmed it worked. May be there something else what cuase this issue? Do you have Sender Name set at the admin?

trucatchtraps commented 5 years ago

Yes Sender name is set. Was working with 2.2.7 but when I upgraded to 2.2.8 started using the email address instead.

xroygbiv commented 5 years ago

@trucatchtraps I have the same issue on 2.2.8 (also, the problem can be reproduced on a clean Magento installation)

here's what I found: Zend\Mail\Message expects two arguments /vendor/zendframework/zend-mail/src/Message.php:144

   public function setFrom($emailOrAddressList, $name = null)
    {
        $this->clearHeaderByName('from');
        return $this->addFrom($emailOrAddressList, $name);
    }

however, the second argument is missing in this method: /vendor/magento/framework/Mail/Message.php:93

    public function setFrom($fromAddress)
    {
        $this->zendMessage->setFrom($fromAddress);
        return $this;
    }

You can override the method just by adding a second argument

    public function setFrom($fromAddress, $name = null)
    {
        $this->zendMessage->setFrom($fromAddress, $name);
        return $this;
    }