8

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?

12

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

  • There is no "Asynchronous sending" – Deepak Kamat Oct 5 '18 at 15:11
  • What is the magento version you are using? – Kamal Singh Oct 8 '18 at 4:21
  • It's Magento/2.2 (Community) – Deepak Kamat Oct 8 '18 at 8:14
  • I have an issue in Magento 2.2.7 – Pratik Mehta Jan 9 at 6:51
  • not working with 2.2.7 – Navin Bhudiya Feb 28 at 7:27
0

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.

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;
}
  • not working this solution for me 2.2.7 – Navin Bhudiya Feb 28 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.