Skip to main content
2 of 4
deleted 3 characters in body
Vishal
  • 773
  • 2
  • 8
  • 18

Add below files into your custom module

Ex:-Namespace:- Mytest Modulename : Myemail;
1 Create customer_account.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-myemail">
                <arguments>
                    <argument name="path" xsi:type="string">myemail/customer/index</argument>
                    <argument name="label" xsi:type="string"> MyEmail</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

2.Create myemail_customer_index.xml into Mytest/Myemail/view/frontend/layout

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
    <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">MyEmail</argument>
            </action>
     </referenceBlock>
     <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="my_email" template="Mytest_Myemail::test.phtml">
        </block>
    </referenceContainer>
</body>
</page>

3 Create Index.php into Mytest/Myemail/Controller/Customer

<?php
namespace Mytest\Myemail\Controller\Customer;

class Index extends \Magento\Framework\App\Action\Action {

 public function execute() {

    $this->_view->loadLayout();

    $this->_view->renderLayout();
  }

}

4.Create test.phtml into Mytest/Myemail/view/frontend/templates

<?php // Add some code ?>
Vishal
  • 773
  • 2
  • 8
  • 18