Domanda

I am experiencing an issue where the sender email address for the order confirmation email is not what is set in the admin panel for Magento 2.3. I have checked both SMTP settings and the store email addresses and none of them match what is being used to send emails. Where would I look in the file structure to find the appropriate file that may contain this email address?

È stato utile?

Soluzione

The actual files that you need to check to debug your issue are SenderBuilder and Sender as given below

its under this path

vendor/magento/module-sales/Model/Order/Email

Magento\Sales\Model\Order\Email\SenderBuilder

investigate the method

/**
     * Configure email template
     *
     * @return void
     */
    protected function configureEmailTemplate()
    {
        $this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
        $this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
        $this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());
        $this->transportBuilder->setFromByScope(
            $this->identityContainer->getEmailIdentity(),
            $this->identityContainer->getStore()->getId()
        );
    }

Magento\Sales\Model\Order\Email\Sender

 /**
     * Create Sender object using appropriate template and identity.
     *
     * @return Sender
     */
    protected function getSender()
    {
        return $this->senderBuilderFactory->create(
            [
                'templateContainer' => $this->templateContainer,
                'identityContainer' => $this->identityContainer,
            ]
        );
    }

In addition to these files, you can also debug this one , where the From Header is set for all the emails.

Magento\Framework\Mail\Template\TransportBuilder

As always, double check your configuration settings (Stores - Configuration - sales - sales email - Order - New Order Confirmation Email Sender) in all the scopes and clean the config cache, before you dive into debugging.

Hope this helps !

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top