9

I Installed magento 2 on my vps server and configured store email like this

but order confitmation email will not send to the customers what should I do , should I setup cron as some link recomended to do this or should I configure my server like this link what is the problem?

3
  • Try with configured cron. Jan 3, 2017 at 3:24
  • Have you resolved this issue? I am also facing the same issue. I have tried all the above soln but not worked for me. Please help me with this. Oct 1, 2020 at 17:58
  • Yes it was a cron issue Oct 2, 2020 at 5:05

3 Answers 3

17

If you have properly configured Magento 2 mailing systems, you may need to check below point:

  1. Got to Stores -> Configuration -> Advanced -> System

Under Mail Sending Settings make sure Disable Email Communications is set to No. Also verify your Host and Port fields if you are using any external mailing server.

  1. Got to Stores -> Configuration -> Sales -> Sales Emails

Under General Settings tab, choose Asynchronous sending to Disable

Under Order tab Enabled to Yes

Now clear/refresh your cache.

Hope this helps you. This solution is tested with Magento 2.1.0

7
  • 1
    There is no "Asynchronous sending" Oct 5, 2018 at 15:11
  • What is the magento version you are using? Oct 8, 2018 at 4:21
  • It's Magento/2.2 (Community) Oct 8, 2018 at 8:14
  • I have an issue in Magento 2.2.7 Jan 9, 2019 at 6:51
  • not working with 2.2.7 Feb 28, 2019 at 7:27
4

This will work.

The transportbuilderbystore class has already been deprecated in 2.3 and soon will be in 2.2.

Fixed in Magento 2.2.7.

Fix: vendor/magento/module-sales/Model/Order/Email/SenderBuilder.php

replace

    $this->transportBuilderByStore->setFromByStore(
        $this->identityContainer->getEmailIdentity(),
        $this->identityContainer->getStore()->getId()
    );

with

    $this->transportBuilder->setFrom(
        $this->identityContainer->getEmailIdentity(), 
        $this->identityContainer->getStore()->getId()
    ); 

vendor/magento/framework/Mail/Template/TransportBuilder.php

replace

/**
 * Set mail from address
 *
 * @param string|array $from
 * @return $this
 */
public function setFrom($from)
{
    $result = $this->_senderResolver->resolve($from);
    $this->message->setFrom($result['email'], $result['name']);
    return $this;
}

with

/**
 * Set mail from address
 *
 * @param string|array $from
 * @return $this
 */
public function setFrom($from, $store = null)
{
    $result = $this->_senderResolver->resolve($from, $store);
    $this->message->setFrom($result['email'], $result['name']);
    return $this;
}

and just like that we do not need the TransportBuilderByStore anymore and it works as expected.

2
0

I had the same issue and found that the actual issue was caused because of "from" header. It was being set twice by some reason. Please update below file to get resolve this issue:

vendor\magento\framework\Mail\Template\TransportBuilderByStore

public function setFromByStore($from, $store)
{
    $result = $this->senderResolver->resolve($from, $store);
    $this->message->setFrom($result['email'], $result['name']);

    return $this;
}

To

public function setFromByStore($from, $store)
{
    $result = $this->senderResolver->resolve($from, $store);

    if ($this->message->getFrom()) {
        $this->message->clearFrom();
    }

    $this->message->setFrom($result['email'], $result['name']);

    return $this;
}
2
  • not working this solution for me 2.2.7 Feb 28, 2019 at 7:27
  • @NavinBhudiya Have you resolved this issue? I am also facing the same issue. I have tried all above soln but not worked for me. Please help me on this. Oct 1, 2020 at 17:57

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.