How to get referer URL in Magento 2.

Magento 2, Get Referer url by calling function getRefererUrl() or getRedirectUrl() from RedirectInterface Object.

Magento core Interface, Magento\Framework\App\Response\RedirectInterface used for fetching Referer URL.

Continue reading “How to get referer URL in Magento 2.”

Send mail from custom module Magento 2

To send custom email in Magento 2 using the module, We need to create a custom module to send email to a specific recipient.

Out of the box, Magento Provides multiple mail template, like Sales Order, Customer mails, Contacts and so on.

If you want to send your custom mail functionality using Magento 2, You need to create a simple module and create a custom template file using Module for mail body.

Continue reading “Send mail from custom module Magento 2”

How to redirect from Observer in Magento 2?

Magento 2, You can redirect to any custom URL from Observer file. When you have created event observer for any specific event and you want to redirect to any URL in a site, You can redirect from observer simply by calling below code,

Create an observer file under app/code/{Packagename}/{Modulename}/YourEventObserver.php

Continue reading “How to redirect from Observer in Magento 2?”