How to setup Mailhog in Ubuntu PHP Magento 2?

MailHog tools are used to test mail functionality from your local development environment.

If you are using Linux/Ubuntu OS with PHP language and want to set up MailHog for your local setup. MailHog tool is the best suited for your system to test web application mails.

First You need to install MailHog using the Command Line Interface (CLI),

Install MailHog,  go get github.com/mailhog/MailHog

Mhsendmail is a Send mail utility created to send emails via MailHog.

Install mhsendmail,  go get github.com/mailhog/mhsendmail

copy MailHog and mhsendmail to the /usr/local/bin path,

Just replace system_user with your system username.

You can get the current username of the system in Linux by command,

Now Modify the php.ini to setup MailHog path,
I am working with PHP 7.4 version, php.ini path location would be /etc/php/7.4/apache2/

From Command Line, Run the command to modify the file,
sudo gedit /etc/php/7.4/apache2/php.ini

Now update ;sendmail_path = with the given line. Remove the semicolon from the starting and update the path,
sendmail_path = /usr/local/bin/mhsendmail
Save the file and restart the PHP to get it to work.

Final Step:

Go To CLI, run the command,

You will see URLs like http://0.0.0.0:8025/
Open this URL in the browser and you will be able to see the web interface of  Mailhog.

You can see more details about MailHog by MailHog README.md link.

How to reset password for the Magento Admin Users?

You can reset the admin user password from the Magento admin panel by hitting the admin URL in the browser.

1. On the Admin Login page, you will be able to see the Login form with forgot password link after the form. Just click on the link, Continue reading “How to reset password for the Magento Admin Users?”

How to get product URL by specific store view in Magento 2?

Magento supports multi-website feature and each website support multi-store view to display store-based eCommerce site to visitors.

If a website has multiple store views and wants to set different URLs for the product by store view level,
you can do it in Magento by just setting the URL based on the store view. Continue reading “How to get product URL by specific store view in Magento 2?”