---
title: "How to fix Wrong Sales Order Email Sender Issue in Magento 2"
url: "https://magecomp.com/blog/fix-wrong-sales-order-email-sender-issue-in-magento-2/"
date: "2019-06-25T16:10:09+00:00"
modified: "2025-02-21T12:36:15+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 611
reading_time: "4 min read"
summary: "Order is a key part of any Ecommerce store, once an order is placed &amp; gets confirmed store owner delivers the product at the customer's doorsteps. But because every store doesn't have the same ..."
description: "If switched to latest Magento 2.2.x you will face an issue of wrong sales order email sender issue in Magento 2.x It means if you set up your own sales order..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "Magento 2: Change &#8220;Add to Cart&#8221; Button Text to &#8220;Item Adding in Cart&#8221; when Item is being Added to Cart"
    url: "https://magecomp.com/blog/magento-2-change-add-to-cart-to-item-adding-in-cart/"
  - title: "How to Restrict Payment Method Based on Shipping selection in Magento 2"
    url: "https://magecomp.com/blog/restrict-payment-method-based-on-shipping-selection-in-magento-2/"
  - title: "How Facebook Messenger AI can be Revolutionary for Ecommerce?"
    url: "https://magecomp.com/blog/facebook-messenger-ai-can-revolutionary-ecommerce/"
---

# How to fix Wrong Sales Order Email Sender Issue in Magento 2

_Published: June 25, 2019_  
_Author: Dhiren Vasoya_  

![How to fix wrong sales order email sender issue in Magento 2 1](https://magecomp.com/blog/wp-content/uploads/2019/06/How-to-fix-wrong-sales-order-email-sender-issue-in-Magento-2-1-1024x332.webp)

Order is a key part of any Ecommerce store, once an order is placed & gets confirmed store owner delivers the product at the customer’s doorsteps. But because every store doesn’t have the same order process that’s the reason why Magento 2.x comes with a preloaded option for customizing order email templates that will constantly serve updates to your customers on each order status change. Not, only this, you can also set email sender if required.
But if you are using an older version of Magento and switched to latest Magento 2.2.x you will face an issue “**[Confirmation emails have no FROM or FROM email address 2.2.4 #14952](https://github.com/magento/magento2/issues/14952)**” also this request was officially pulled in Magento 3 Github by @tstamplis. It means even if you set up your own sales order email sender, Magento will send an email using default server sender i.e.apache@domainname but other emails except sales are working perfectly fine. Because we have seen lots of people are facing the same issue we have decided to write a blog about.

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-3.webp)](https://magecomp.com/services/magento-upgrade-services/)
Firstly, we have to create custom extension for this purpose and after that create “**module.xml**”
file at this path inside your extension folder.
 **app\code\Vendor\Extension\etc\module.xml**

```

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
        <module name="Vendor_Extension" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Sales"/>
        </sequence>
    </module>
</config>
```

Now, create one more file “**di.xml**” in same extension folder.
**app\code\Vendor\Extension\etc\ di.xml**

```

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoSalesModelOrderEmailSenderBuilder" type="VendorExtensionRewriteSalesModelOrderEmailSenderBuilder" />
    <preference for="MagentoFrameworkMailTemplateTransportBuilder" type="VendorExtensionRewriteFrameworkMailTemplateTransportBuilder" />
</config>
```

[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-3.webp)](https://magecomp.com/magento-performance-optimization.html)

Now in this third step create “**TransportBuilder.php**” file at this path using given code.
**app\code\Vendor\Extension\Rewrite\Framework\Mail\Template\TransportBuilder.php**

```

<?php

namespace VendorExtensionRewriteFrameworkMailTemplate;
class TransportBuilder extends MagentoFrameworkMailTemplateTransportBuilder
{
    /**
     * @param $from
     * @param $store
     * @return $this
     * @throws MagentoFrameworkExceptionMailException
     */
    public function setFromByStore($from, $store)
    {
        $result = $this->_senderResolver->resolve($from, $store);
        $this->message->setFrom($result['email'], $result['name']);
        return $this;
    }
}
```

Now, in fourth and last step create **SenderBuilder.php** at this path.

 **app\code\Vendor\Extension\Rewrite\Sales\Model\Order\Email\SenderBuilder.php**

```

<?php

namespace VendorExtensionRewriteSalesModelOrderEmail;
class SenderBuilder extends MagentoSalesModelOrderEmailSenderBuilder
{
    /**
     * 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->setFromByStore(
            $this->identityContainer->getEmailIdentity(),
            $this->identityContainer->getStore()->getId()
        );
    }
}
```

That’s it! After creating custom extension using above code, your Magento 2 will start sending sales order email to your customers from define email sender.

 Lastly, If you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends.

[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-2.webp)](https://magecomp.com/services/hyva-theme-development/)

And, Let us know if you are facing an issue while implementing this code.

Happy Fixing!


---

_View the original post at: [https://magecomp.com/blog/fix-wrong-sales-order-email-sender-issue-in-magento-2/](https://magecomp.com/blog/fix-wrong-sales-order-email-sender-issue-in-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-27 19:39:07 UTC_  
