Sales Emails going via wrong email address magento 2.2.x












0















I have setup email address in sales representative but getting sales email from




apache@domainname




So where I need to fix this issue? Can anyone let me know?



Other emails except sales are working fine.










share|improve this question




















  • 1





    Please check my ans, as I had same issue before and I have solved it.

    – Aasim Goriya
    Sep 8 '18 at 6:10











  • Okay, I am trying.

    – Vinod Kumar
    Sep 8 '18 at 6:13











  • ok please let me know if anything

    – Aasim Goriya
    Sep 8 '18 at 6:40
















0















I have setup email address in sales representative but getting sales email from




apache@domainname




So where I need to fix this issue? Can anyone let me know?



Other emails except sales are working fine.










share|improve this question




















  • 1





    Please check my ans, as I had same issue before and I have solved it.

    – Aasim Goriya
    Sep 8 '18 at 6:10











  • Okay, I am trying.

    – Vinod Kumar
    Sep 8 '18 at 6:13











  • ok please let me know if anything

    – Aasim Goriya
    Sep 8 '18 at 6:40














0












0








0








I have setup email address in sales representative but getting sales email from




apache@domainname




So where I need to fix this issue? Can anyone let me know?



Other emails except sales are working fine.










share|improve this question
















I have setup email address in sales representative but getting sales email from




apache@domainname




So where I need to fix this issue? Can anyone let me know?



Other emails except sales are working fine.







magento2 email order-email sales magento2.2.4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 12 '18 at 5:16









Aasim Goriya

2,6611734




2,6611734










asked Sep 8 '18 at 4:35









Vinod KumarVinod Kumar

908319




908319








  • 1





    Please check my ans, as I had same issue before and I have solved it.

    – Aasim Goriya
    Sep 8 '18 at 6:10











  • Okay, I am trying.

    – Vinod Kumar
    Sep 8 '18 at 6:13











  • ok please let me know if anything

    – Aasim Goriya
    Sep 8 '18 at 6:40














  • 1





    Please check my ans, as I had same issue before and I have solved it.

    – Aasim Goriya
    Sep 8 '18 at 6:10











  • Okay, I am trying.

    – Vinod Kumar
    Sep 8 '18 at 6:13











  • ok please let me know if anything

    – Aasim Goriya
    Sep 8 '18 at 6:40








1




1





Please check my ans, as I had same issue before and I have solved it.

– Aasim Goriya
Sep 8 '18 at 6:10





Please check my ans, as I had same issue before and I have solved it.

– Aasim Goriya
Sep 8 '18 at 6:10













Okay, I am trying.

– Vinod Kumar
Sep 8 '18 at 6:13





Okay, I am trying.

– Vinod Kumar
Sep 8 '18 at 6:13













ok please let me know if anything

– Aasim Goriya
Sep 8 '18 at 6:40





ok please let me know if anything

– Aasim Goriya
Sep 8 '18 at 6:40










2 Answers
2






active

oldest

votes


















2














Please check following steps to resolve this issue.



Create your custom module to rewrite core files



In your /Vendor/Module/etc/di.xml add following code



<?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="VendorModuleRewriteSalesModelOrderEmailSenderBuilder" />
<preference for="MagentoFrameworkMailTemplateTransportBuilder" type="VendorModuleRewriteFrameworkMailTemplateTransportBuilder" />
</config>


In your /Vendor/Module/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_Module" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
</config>


In your Vendor/Module/Rewrite/Framework/Mail/Template/TransportBuilder.php



<?php

namespace VendorModuleRewriteFrameworkMailTemplate;
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;
}
}


In your Vendor/Module/Rewrite/Sales/Model/Order/Email/SenderBuilder.php



<?php

namespace VendorModuleRewriteSalesModelOrderEmail;
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());
/*Send From Email Issue #Dev110*/
$this->transportBuilder->setFromByStore(
$this->identityContainer->getEmailIdentity(),
$this->identityContainer->getStore()->getId()
);
/*Send From Email Issue #Dev110*/
// $this->transportBuilderByStore->setFromByStore(
// $this->identityContainer->getEmailIdentity(),
// $this->identityContainer->getStore()->getId()
// );
}
}





share|improve this answer





















  • 1





    Perfect...this is working fine for me. thank you

    – Vinod Kumar
    Sep 8 '18 at 7:11



















0














Its working but issue with Store Name. No store name showing in From email





share








New contributor




Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f241390%2fsales-emails-going-via-wrong-email-address-magento-2-2-x%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Please check following steps to resolve this issue.



    Create your custom module to rewrite core files



    In your /Vendor/Module/etc/di.xml add following code



    <?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="VendorModuleRewriteSalesModelOrderEmailSenderBuilder" />
    <preference for="MagentoFrameworkMailTemplateTransportBuilder" type="VendorModuleRewriteFrameworkMailTemplateTransportBuilder" />
    </config>


    In your /Vendor/Module/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_Module" setup_version="1.0.0">
    <sequence>
    <module name="Magento_Sales"/>
    </sequence>
    </module>
    </config>


    In your Vendor/Module/Rewrite/Framework/Mail/Template/TransportBuilder.php



    <?php

    namespace VendorModuleRewriteFrameworkMailTemplate;
    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;
    }
    }


    In your Vendor/Module/Rewrite/Sales/Model/Order/Email/SenderBuilder.php



    <?php

    namespace VendorModuleRewriteSalesModelOrderEmail;
    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());
    /*Send From Email Issue #Dev110*/
    $this->transportBuilder->setFromByStore(
    $this->identityContainer->getEmailIdentity(),
    $this->identityContainer->getStore()->getId()
    );
    /*Send From Email Issue #Dev110*/
    // $this->transportBuilderByStore->setFromByStore(
    // $this->identityContainer->getEmailIdentity(),
    // $this->identityContainer->getStore()->getId()
    // );
    }
    }





    share|improve this answer





















    • 1





      Perfect...this is working fine for me. thank you

      – Vinod Kumar
      Sep 8 '18 at 7:11
















    2














    Please check following steps to resolve this issue.



    Create your custom module to rewrite core files



    In your /Vendor/Module/etc/di.xml add following code



    <?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="VendorModuleRewriteSalesModelOrderEmailSenderBuilder" />
    <preference for="MagentoFrameworkMailTemplateTransportBuilder" type="VendorModuleRewriteFrameworkMailTemplateTransportBuilder" />
    </config>


    In your /Vendor/Module/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_Module" setup_version="1.0.0">
    <sequence>
    <module name="Magento_Sales"/>
    </sequence>
    </module>
    </config>


    In your Vendor/Module/Rewrite/Framework/Mail/Template/TransportBuilder.php



    <?php

    namespace VendorModuleRewriteFrameworkMailTemplate;
    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;
    }
    }


    In your Vendor/Module/Rewrite/Sales/Model/Order/Email/SenderBuilder.php



    <?php

    namespace VendorModuleRewriteSalesModelOrderEmail;
    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());
    /*Send From Email Issue #Dev110*/
    $this->transportBuilder->setFromByStore(
    $this->identityContainer->getEmailIdentity(),
    $this->identityContainer->getStore()->getId()
    );
    /*Send From Email Issue #Dev110*/
    // $this->transportBuilderByStore->setFromByStore(
    // $this->identityContainer->getEmailIdentity(),
    // $this->identityContainer->getStore()->getId()
    // );
    }
    }





    share|improve this answer





















    • 1





      Perfect...this is working fine for me. thank you

      – Vinod Kumar
      Sep 8 '18 at 7:11














    2












    2








    2







    Please check following steps to resolve this issue.



    Create your custom module to rewrite core files



    In your /Vendor/Module/etc/di.xml add following code



    <?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="VendorModuleRewriteSalesModelOrderEmailSenderBuilder" />
    <preference for="MagentoFrameworkMailTemplateTransportBuilder" type="VendorModuleRewriteFrameworkMailTemplateTransportBuilder" />
    </config>


    In your /Vendor/Module/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_Module" setup_version="1.0.0">
    <sequence>
    <module name="Magento_Sales"/>
    </sequence>
    </module>
    </config>


    In your Vendor/Module/Rewrite/Framework/Mail/Template/TransportBuilder.php



    <?php

    namespace VendorModuleRewriteFrameworkMailTemplate;
    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;
    }
    }


    In your Vendor/Module/Rewrite/Sales/Model/Order/Email/SenderBuilder.php



    <?php

    namespace VendorModuleRewriteSalesModelOrderEmail;
    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());
    /*Send From Email Issue #Dev110*/
    $this->transportBuilder->setFromByStore(
    $this->identityContainer->getEmailIdentity(),
    $this->identityContainer->getStore()->getId()
    );
    /*Send From Email Issue #Dev110*/
    // $this->transportBuilderByStore->setFromByStore(
    // $this->identityContainer->getEmailIdentity(),
    // $this->identityContainer->getStore()->getId()
    // );
    }
    }





    share|improve this answer















    Please check following steps to resolve this issue.



    Create your custom module to rewrite core files



    In your /Vendor/Module/etc/di.xml add following code



    <?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="VendorModuleRewriteSalesModelOrderEmailSenderBuilder" />
    <preference for="MagentoFrameworkMailTemplateTransportBuilder" type="VendorModuleRewriteFrameworkMailTemplateTransportBuilder" />
    </config>


    In your /Vendor/Module/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_Module" setup_version="1.0.0">
    <sequence>
    <module name="Magento_Sales"/>
    </sequence>
    </module>
    </config>


    In your Vendor/Module/Rewrite/Framework/Mail/Template/TransportBuilder.php



    <?php

    namespace VendorModuleRewriteFrameworkMailTemplate;
    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;
    }
    }


    In your Vendor/Module/Rewrite/Sales/Model/Order/Email/SenderBuilder.php



    <?php

    namespace VendorModuleRewriteSalesModelOrderEmail;
    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());
    /*Send From Email Issue #Dev110*/
    $this->transportBuilder->setFromByStore(
    $this->identityContainer->getEmailIdentity(),
    $this->identityContainer->getStore()->getId()
    );
    /*Send From Email Issue #Dev110*/
    // $this->transportBuilderByStore->setFromByStore(
    // $this->identityContainer->getEmailIdentity(),
    // $this->identityContainer->getStore()->getId()
    // );
    }
    }






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 8 '18 at 6:09

























    answered Sep 8 '18 at 6:03









    Aasim GoriyaAasim Goriya

    2,6611734




    2,6611734








    • 1





      Perfect...this is working fine for me. thank you

      – Vinod Kumar
      Sep 8 '18 at 7:11














    • 1





      Perfect...this is working fine for me. thank you

      – Vinod Kumar
      Sep 8 '18 at 7:11








    1




    1





    Perfect...this is working fine for me. thank you

    – Vinod Kumar
    Sep 8 '18 at 7:11





    Perfect...this is working fine for me. thank you

    – Vinod Kumar
    Sep 8 '18 at 7:11













    0














    Its working but issue with Store Name. No store name showing in From email





    share








    New contributor




    Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      Its working but issue with Store Name. No store name showing in From email





      share








      New contributor




      Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        Its working but issue with Store Name. No store name showing in From email





        share








        New contributor




        Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        Its working but issue with Store Name. No store name showing in From email






        share








        New contributor




        Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share


        share






        New contributor




        Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 3 mins ago









        RanjeetRanjeet

        1




        1




        New contributor




        Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Ranjeet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f241390%2fsales-emails-going-via-wrong-email-address-magento-2-2-x%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What other Star Trek series did the main TNG cast show up in?

            Berlina muro

            Berlina aerponto