If you want to send transnational emails for another cc mail to the customer, then follow below steps.
Step 1: Create a registration file like Magemonkey/EmailCC/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Magemonkey_EmailCC',
__DIR__
);
Step 2: Create di file like Magemonkey/EmailCC/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">
<type name="MagentoFrameworkMailTemplateTransportBuilder">
<plugin disabled="false" name="Magemonkey_EmailCC_Plugin_Magento_Framework_Mail_Template_TransportBuilder" sortOrder="10" type="MagemonkeyEmailCCPluginMagentoFrameworkMailTemplateTransportBuilder"/>
</type>
</config>
Step 3: Create module file like Magemonkey/EmailCC/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="Magemonkey_EmailCC" setup_version="1.1.0">
<sequence>
<module name="Magento_Customer"/>
<module name="Magento_Framework"/>
</sequence>
</module>
</config>
Step 4: Create extension attributes file like Magemonkey/EmailCC/etc/extension_attributes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoCustomerApiDataCustomerInterface">
<attribute code="mm_emailcc" type="string"/>
</extension_attributes>
</config>
Step 5: Create plugin file like Magemonkey/EmailCC/Plugin/Magento/Framework/Mail/Template/TransportBuilder.php
<?php
namespace MagemonkeyEmailCCPluginMagentoFrameworkMailTemplate;
/**
* Plugin to add customer email cc
*/
class TransportBuilder
{
/**
* @var MagentoCustomerApiCustomerRepositoryInterface
*/
protected $customerRepositoryInterface;
/**
* @var MagentoCustomerModelSession
*/
protected $customerSession;
/**
* @var PsrLogLoggerInterface
*/
protected $logger;
public function __construct(
MagentoCustomerApiCustomerRepositoryInterface $customerRepositoryInterface,
MagentoCustomerModelSession $customerSession,
PsrLogLoggerInterface $logger
) {
$this->customerRepositoryInterface = $customerRepositoryInterface;
$this->customerSession = $customerSession;
$this->logger = $logger;
}
public function beforeGetTransport(
MagentoFrameworkMailTemplateTransportBuilder $subject
) {
try {
$ccEmailAddresses = $this->getEmailCopyTo();
if (!empty($ccEmailAddresses)) {
foreach ($ccEmailAddresses as $ccEmailAddress) {
$subject->addCc(trim($ccEmailAddress));
$this->logger->debug((string) __('Added customer CC: %1', trim($ccEmailAddress)));
}
}
} catch (Exception $e) {
$this->logger->error((string) __('Failure to add customer CC: %1', $e->getMessage()));
}
return [];
}
/**
* Get customer id from session
*/
public function getCustomerIdFromSession()
{
if ($customer = $this->customerSession->getCustomer()) {
return $customer->getId();
}
return null;
}
/**
* Return email copy_to list
* @return array|bool
*/
public function getEmailCopyTo()
{
$customerId = $this->getCustomerIdFromSession();
if (!$customerId) {
return false;
}
$customer = $this->getCustomerById($customerId);
if (!$customer) {
return false;
}
$emailCc = $customer->getCustomAttribute('mm_emailcc');
$customerEmailCC = $emailCc ? $emailCc->getValue() : null;
if (!empty($customerEmailCC)) {
return explode(',', trim($customerEmailCC));
}
return false;
}
/**
* Get customer by Id.
* @param int $customerId
* @return MagentoCustomerModelDataCustomer
*/
public function getCustomerById($customerId)
{
try {
return $this->customerRepositoryInterface->getById($customerId);
} catch (Exception $e) {
$this->logger->critical($e);
return false;
}
}
}
Step 6: Create a setup file like Magemonkey/EmailCC/Setup/Patch/Data/AddEmailCcCustomerAttribute.php
<?php
declare(strict_types=1);
namespace MagemonkeyEmailCCSetupPatchData;
use MagentoCustomerModelCustomer;
use MagentoCustomerSetupCustomerSetup;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoEavModelEntityAttributeSet;
use MagentoEavModelEntityAttributeSetFactory;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupPatchDataPatchInterface;
use MagentoFrameworkSetupPatchPatchRevertableInterface;
class AddEmailCcCustomerAttribute implements DataPatchInterface, PatchRevertableInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;
/**
* @var CustomerSetup
*/
private $customerSetupFactory;
/**
* @var SetFactory
*/
private $attributeSetFactory;
/**
* Constructor
*
* @param ModuleDataSetupInterface $moduleDataSetup
* @param CustomerSetupFactory $customerSetupFactory
* @param SetFactory $attributeSetFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
CustomerSetupFactory $customerSetupFactory,
SetFactory $attributeSetFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->customerSetupFactory = $customerSetupFactory;
$this->attributeSetFactory = $attributeSetFactory;
}
/**
* {@inheritdoc}
*/
public function apply()
{
$this->moduleDataSetup->getConnection()->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType(Customer::ENTITY);
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
/** @var $attributeSet Set */
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(
Customer::ENTITY,
'mm_emailcc',
[
'type' => 'varchar',
'label' => 'Email CC',
'input' => 'text',
'source' => '',
'required' => false,
'visible' => true,
'position' => 500,
'system' => false,
'backend' => '',
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => false,
'note' => __("Comma separated"),
]
);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'mm_emailcc');
$attribute->addData([
'used_in_forms' => [
'adminhtml_customer',
'adminhtml_checkout',
'customer_account_create',
'customer_account_edit'
]
]);
$attribute->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId
]);
$attribute->save();
$this->moduleDataSetup->getConnection()->endSetup();
}
public function revert()
{
$this->moduleDataSetup->getConnection()->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
$customerSetup->removeAttribute(Customer::ENTITY, 'mm_emailcc');
$this->moduleDataSetup->getConnection()->endSetup();
}
/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
/**
* {@inheritdoc}
*/
public static function getDependencies()
{
return [];
}
}
Step 7: Create layout file like Magemonkey/EmailCC/view/frontend/layout/customer_account_edit.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
<referenceContainer name="content">
<block class="MagentoCustomerBlockFormEdit" name="customer_edit" template="Magento_Customer::form/edit.phtml" cacheable="false">
<container name="form.additional.info" as="form_additional_info">
<block class="MagentoCustomerBlockFormEdit" as="customer_edit_cc" name="customer.edit.css" template="Magemonkey_EmailCC::form/mm_emailcc.phtml"/>
</container>
</block>
</referenceContainer>
</body>
</page>
Step 8 : Create template file like Magemonkey/EmailCC/view/frontend/templates/form/mm_emailcc.phtml
<?php
$emailCc = $block->getCustomer()->getCustomAttribute('mm_emailcc');
$customerEmailCC = $emailCc ? $emailCc->getValue() : null;
?>
<fieldset class="fieldset create account" >
<legend class="legend">
<span><?=$block->escapeHtmlAttr(__('Email Copy To'))?></span>
</legend>
<br>
<div class="field mm_emailcc">
<label for="mm_emailcc" class="label">
<span><?=$block->escapeHtmlAttr(__('Email Address (Comma separated)'));?></span>
</label>
<div class="control">
<input id="mm_emailcc"
class="input-text"
name="mm_emailcc"
value="<?=$block->escapeHtmlAttr($customerEmailCC);?>"
title="<?=$block->escapeHtmlAttr(__('Email Copy To'));?>"
type="text"
autocomplete="off" />
</div>
</div>
</fieldset>
Step 9: Then after run the below commands.
php bin/magento setup:upgrade php bin/magento setup:static-content:deploy php bin/magento cache:flush
That’s it…
Now clean cache and check “Admin > CUSTOMERS > Customers > All Customers > Edit any customer”. Your new email address cc field option should appear here in the last.

