Automatic mail alert to customers on new products arrival in magento

Automatic mail alert to customers on new products arrival in magento

September 30, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Automatic mail alert to customers on new products arrival in magento

Automatic Product Alerts for Magento Customers

Automatically notifying customers about new product arrivals is an effective way to increase engagement and sales in your online store. In this article, we’ll guide you through implementing automatic mail alerts for your Magento customers when new products hit the shelves.

Current Limitations of RSS Feeds

Before we dive into the solution, let’s first understand why plain RSS feeds don’t suffice for this purpose:

  1. Limited Functionality: RSS only provides updates on content changes but lacks the ability to trigger automatic notifications based on specific events like product addition.
  2. Lack of Personalization: RSS cannot send targeted alerts based on a customer’s subscription preferences or previously viewed products.

The Ideal Solution: Automatic Email Alerts

To overcome these limitations, we recommend setting up an automated email system that can:

  • Check for new product additions at regular intervals
  • Filter out relevant products based on the subscriber’s interests
  • Send personalized emails with product details and images

Setting Up Automatic Mail Alerts in Magento 2

Step 1: Create a New Cron Job

In your app/code/Vendor/Module/etc/crontab.xml file, add a new cron job to check for new products every hour:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="check_new_products" instance="Vendor\Module\Observer\NewProductChecker" method="execute">
            <schedule>0 * * * *</schedule>
        </job>
    </group>
</config>

Step 2: Create the Observer

Your observer should reside in app/code/Vendor/Module/Observer/NewProductChecker.php:

public function execute()
{
    $newProducts = $this->productCollectionFactory->create()->addAttributeToFilter('entity_id', ['gt' => $lastUpdateTime])->load();
    foreach ($newProducts as $product) {
        $subscribers = $this->getSubscribersForProduct($product);
        foreach ($subscribers as $subscriberEmail) {
            $this->sendEmail($product, $subscriberEmail);
        }
    }
    // Update the last updated time
    $this->_registry->register('last_product_check_time', now());
}

Step 3: Get Subscribed Customers

You’ll need to create a method to retrieve customers who have subscribed for alerts on that particular category or product.

Step 4: Send the Email

Finally, use Magento’s built-in email functionality to send emails:

public function sendEmail($product, $customerEmail)
{
    $transport = $this->transportBuilder->setTemplateIdentifier('new_product')->setTemplateOptions(['area' => 'frontend'])->getTransport();
    $transport->sendMessage();
}

Leveraging Laravel for Advanced Features

For more advanced features, consider integrating your Magento store with a Laravel application using Magento’s REST API. This allows you to:

  • Create a more sophisticated filtering system
  • Implement complex email templates
  • Handle delivery failures and rescheduling

Visit Laravel Company for step-by-step guides on integrating Laravel with your Magento store.

Conclusion: Enhancing Your Customer Experience

Automatic mail alerts are a powerful tool for keeping customers engaged and informed. By following this approach, you can:

  • Increase customer loyalty by providing relevant content
  • Boost sales through targeted product recommendations
  • Improve customer satisfaction through proactive communication

Remember to test your implementation thoroughly before rolling it out to all users. With proper configuration and monitoring, automatic mail alerts can become a key part of your Magento e-commerce strategy.

Happy coding!

Magento 2 Catalog API Extensions

Our network