I am trying to send an email to a friend for products https://prnt.sc/oujsr5 but getting this error https://prnt.sc/ole1kk.

I am using outlook service provider.


Can you advise on what extension you are using? or are you using the standard magento functionality?

The issue is down to any email client using smtp-mail.outlook.com to send email.

In July, there was a change that disallowed you using a return email address that are not in your list of verified email aliases or connected accounts.

In other words, you can't change the "From" field in emails you send to an anonymous email address.

  • then how will the email to friend functionality works. There we are sending an email with customers email address in from field and not the registered email address. I am using Mageplaza SMTP module. – Nafisa Aug 19 at 11:06
  • I would raise a support ticket with them regarding this as they created the module and without physically downloading and implimenting i cannot be 100% – Dava Gordon Aug 19 at 11:09
  • @DavaGordan. Will this work with default magento email functionlity? – Nafisa Aug 19 at 11:31
  • It works on default magento as you are not changing the from email in the default magento platform – Dava Gordon Aug 19 at 12:33

Override \Mageplaza\Smtp\Mail\Transport File In Your Custom Module :-


 <?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="\Mageplaza\Smtp\Mail\Transport" type="Vendor\Module\Mail\Transport" />

Create Transport.php File On This Location Vendor\Module\Mail\Transport


namespace Vendor\Module\Mail;

use Closure;
use Exception;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Mail\TransportInterface;
use Magento\Framework\Phrase;
use Magento\Framework\Registry;
use Mageplaza\Smtp\Helper\Data;
use Mageplaza\Smtp\Mail\Rse\Mail;
use Mageplaza\Smtp\Model\LogFactory;
use Psr\Log\LoggerInterface;
use Zend\Mail\Message;

class Transport extends \Mageplaza\Smtp\Mail\Transport
    public function __construct(Mail $resourceMail, LogFactory $logFactory, Registry $registry, Data $helper, LoggerInterface $logger)
        parent::__construct($resourceMail, $logFactory, $registry, $helper, $logger);

    public function aroundSendMessage(
        TransportInterface $subject,
        Closure $proceed
        $this->_storeId = $this->registry->registry('mp_smtp_store_id');
        $message = $this->getMessage($subject);
        if ($this->resourceMail->isModuleEnable($this->_storeId) && $message) {
            if ($this->helper->versionCompare('2.2.8')) {
                $message = Message::fromString($message->getRawMessage())->setEncoding('utf-8');
            $message = $this->resourceMail->processMessage($message, $this->_storeId);
            /* Custom code start here */

            foreach ($message->getFrom() as $address) {
                $senderEmail = $address->getEmail();
                $senderName = $address->getName();

            /* custom code end here */
            $transport = $this->resourceMail->getTransport($this->_storeId);
            try {
                if (!$this->resourceMail->isDeveloperMode($this->_storeId)) {
                if ($this->helper->versionCompare('2.2.8')) {
                    $messageTmp = $this->getMessage($subject);
                    if ($messageTmp && is_object($messageTmp)) {
                        $body = $messageTmp->getBody();
                        if (is_object($body) && $body->isMultiPart()) {

            } catch (Exception $e) {
                $this->emailLog($message, false);
                throw new MailException(new Phrase($e->getMessage()), $e);
        } else {
  • i am not creating any custom module. – Nafisa Aug 19 at 11:30
  • to resolve this issue, you need to create above files in your custom module – Rk Rathod Aug 19 at 11:32
  • Which custom module? – Nafisa Aug 19 at 11:37
  • custom module means create new module if you dont want to direct change in Core File.... – Rk Rathod Aug 19 at 11:38
  • For what? Do didnt get my question i guess – Nafisa Aug 19 at 11:39

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.