# Automatic campaigns

This feature is mainly used to send send an email each time a new article is published on the site, or to send a monthly email containing the 3 last products of your e-commerce solution.

### Create an automatic campaign

First of all, create an ordinary campaign, then select the "Automatic" option in its [Send settings](/main-pages/campaigns/creation-of-a-campaign/send-settings.md#when-do-you-want-your-email-to-be-sent) tab.

![](/files/tBCXFiIAajvDqQTsM6E5)

Here are the additional settings:

* **Type of trigger**: this option allows you to choose the type of trigger you want for this campaign. For example, you can trigger it every day at 10 am, each time AcyMailing is triggered via the cron...
* **Start date**: if this option is set, your campaign won't generate campaign until this date
* **Ask for confirmation**: if you activate this option, the generated campaigns won't be sent so you'll have to confirm them manually (useful when testing the auto campaign feature when you're unsure).
* **Email to send the notification to:** if you enable the confirmation before sending you can choose the email address the notification will be sent to when an email is automatically generated. A link to confirm the sending will be included in the notification email.
* **Track campaign**: if this option is set it won't track the open and click stat on every campaign generated

![](/files/-MVax5SW4SrydHFUrSxb)

The generated emails can be found in the campaigns listing under the "Generated" filter. The ones you have to confirm are labeled "Waiting for confirmation" and the name (not the subject) of each generated email will be suffixed with the "#email number".

![](/files/-MVaxPLZu-pbgJujGb0d)

The "Send" button will confirm this email, it will be added to the queue.\
You can access the automatic campaign that generated this email from the link at the top of the page.

### Send a different content for each email

Ok you know how to setup a campaign sent each month, it would be nice to have a different content in each mail instead of sending over and over the same one.

In this example, we'll setup an automatic campaign that sends the 3 last articles of your site (Joomla in this screenshot, but it's the same for WordPress) each month.

First, insert articles by category in your email:

![](/files/-LteIE2KyKP7jFdK4gX2)

Select or not some categories and the way you want the articles to be displayed, then here's the important step:

![](/files/-M8PPYRqHedyB8dUxDFN)

When an email is generated, you want to insert the **3 last** articles, so "Max. number of elements" must be set to "3", and the articles inserted in your email are ordered by latest published (you can keep the default "ID" value, it's the same result).

### Don't send twice the same content

Right, an email is sent each month with the 3 last articles of your site, but what happens if no article has been published during a month?

![](/files/-MVayo99_MWhCxz6ufqh)

The first option makes sure that the same article isn't sent twice. If there are only two new articles since the last email was sent, only those two will be inserted in the next email.

The "Min. number of elements" option is really special, if no new article has been published on your site, **no email will be sent** and AcyMailing will wait for the next month (instead of sending an empty email).

{% hint style="warning" %}
This is independant from other content you could insert in your email, if the min. number of elements isn't reached, the email won't be generated no matter if you insert an other dynamic content in the same automatic campaign.
{% endhint %}

You can do this with pretty much any dynamic content you can insert in your emails, thanks to the add-ons.

### Examples

#### Send an email each time a new content is published

To send an email each time a new WooCommerce / VirtueMart product is published on your site:

1. Create an automatic campaign sent "Each time AcyMailing is triggered"
2. Insert a product by category with these options:
   1. Max. number of elements: 1
   2. Order by: ID/publishing date/creation date, descending
   3. Only newly created: Yes
   4. Min. number of elements: 1

#### Send an email 3 days before an event starts

You may need to tell your users when an event is about to start, in JEvents or Event Booking for example:

1. Create an automatic campaign sent "Every day at 10:00"
2. Insert an event by category with these options:
   1. Max. number of elements: 1
   2. Order by: starting date, ascending
   3. Only newly created: Yes/No, doesn't matter
   4. Min. number of elements: 1
   5. From: 3 days after
   6. To: 4 days after


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acymailing.com/main-pages/campaigns/automatic-campaigns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
