Pimcore guides &amp; How to 2 min read

# Sending emails with assets and generated links using CLI in Pimcore

You're sending emails through Pimcore? Learn how to configure Pimcore to include both assets and generated links in your emails!

Last updated on 29 August, 2025

## Key takeaways

1. Emails sent from the Pimcore command line need the Main Domain set in System Settings, otherwise asset paths lack the base URL and images do not display.
2. With Main Domain configured, an asset path such as /Products/image\_example.jpg becomes a full URL including the website domain.
3. Generating links from the command line requires the router.request\_context.base\_url parameter in parameters.yml, because there is no request to supply the base URL.
4. After changing these settings, clear the cache with bin/console c:c and send a test email to check that all URLs include the base URL.

![Configuring System settings in Pimcore administration](https://factory.dev/wp-content/uploads/2026/11/configuring-system-settings-in-pimcore-administration.png)

## **What you’ll learn with this guide**

In this guide, you will learn the configuration steps needed to properly include assets and generated links in emails sent through a command in Pimcore.

## **Where to use**

One of many use cases is sending automatic emails to your users or clients. Every email nowadays contains a logo or some other sort of asset and/or links! Without first setting things up in your Pimcore admin panel and project files you will not be able to send emails with the above-mentioned properties if they are sent through the command line.

## **Solution**

Let’s start with the admin panel in Pimcore. For Pimcore to know the base\_url for your assets when sending emails we need to configure System Settings > Website.

![Configuring System settings in Pimcore administration](https://factory.dev/wp-content/uploads/2026/11/configuring-system-settings-in-pimcore-administration.png)

Now change the Main Domain property to your website URL (if you are running Pimcore locally change it to your local IP address), and save your changes.

![Configuring the main domain setting in Pimcore administration](https://factory.dev/wp-content/uploads/2026/11/configuring-the-main-domain-setting-in-pimcore-administration.png)

An example of what would happen if we are sending emails through the command line without setting the Main Domain property is that the assets would not generate a valid full path.

E.g. you’re sending images of products within your email and they are located in a folder called Products within your assets. The generated full path without changing this setting would look like this: **“/Products/image\_example.jpg”** and therefore will not show up in your email, but with the configuration set, it will be **“http://example.com/Products/image\_example.jpg”**.

The next step is configuring your router. To generate links we need to use the RouterInterface which uses the current request to generate the **base\_url** for your link. To set the router parameters (since we don’t have a request to configure it) we will need to edit the **parameters.yml** file located in **my-project/app/config/parameters.yml.**

Add a new parameter called **router.request\_context.base\_url** and pass your **base\_url.**

E.g.

**parameters:
router.request\_context.base\_url: example.com**

After adding all of the above-mentioned changes please clear your cache **(bin/console c:c)** to make sure the changes are loading correctly.

That’s it!

## **Does it work?**

To test if your emails are configured correctly, send an email using your command line and check if the URL-s generated for all of your assets and links contain a **base\_url**.

## **If you’d like some help with Pimcore, feel free to say hello@factory.dev!**

## Related

[Pimcore guides &amp; How to **Pimcore Studio Setup Guide: Backend &amp; Infrastructure for Developers** Step-by-step overview of Pimcore Studio backend setup, including required services, DDEV configuration, bundle installation, indexing, and production considerations. 34 min read](https://factory.dev/pimcore-knowledge-base/tutorial/pimcore-studio-setup-guide-backend-infrastructure) [Pimcore guides &amp; How to **Customizing Pimcore Classification Store: Removing Grid View Duplicates and Simplifying DataHub Imports** Shared Classification Store attributes can clutter Pimcore grid views and make DataHub imports harder to maintain. This article shows how a custom implementation creates one logical attribute view… 10 min read](https://factory.dev/pimcore-knowledge-base/how-to/customizing-pimcore-classification-store) [Pimcore guides &amp; How to **Using named API routes in separated Vue CLI generated Applications** Discover how to use named, and exposed routes via Symfony FOSJsRoutingBundle in separated Vue CLI generated Applications. 2 min read](https://factory.dev/pimcore-knowledge-base/how-to/named-api-routes-in-separated-vue-cli-generated-applications)

---

Source: https://factory.dev/pimcore-knowledge-base/how-to/pimcore-sending-emails
