# BreezingForms and AcyMailing

## Description <a href="#description" id="description"></a>

If you use BreezingForms on your website, you can integrate AcyMailing withBreezingForms so that when a user submits a form, this user is also subscribed to one or several AcyMailing Lists.

## Integration with BreezingForms <a href="#integration-with-breezingforms" id="integration-with-breezingforms"></a>

You should first create your form and **save it**.

### QuickMode <a href="#quickmode" id="quickmode"></a>

If you're using the QuickMode click on the **More options** link in the **Advanced** Tab.

![](https://4212440522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_D4iy53WFAtKVs3BPA%2F-MJWDIW14HYGp_iv2IIH%2F-MJWDOwXobcNMhSDZR9R%2Fbreezingforms_moreoptions.png?alt=media\&token=53cc02c2-2c28-429f-9111-66eb1075da3c)

### EasyMode or ClassicMode <a href="#easymode-or-classicmode" id="easymode-or-classicmode"></a>

If you're using the EasyMode or ClassicMode click on the **Form settings** Button.

![](https://4212440522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_D4iy53WFAtKVs3BPA%2F-MJWDIW14HYGp_iv2IIH%2F-MJWDRAk56dHoG10D-rq%2Fbreezingforms_formsettings.png?alt=media\&token=720d2081-5eef-4be5-9936-a6f88ea30ba5)

### Add the subscription code in your form <a href="#add-the-subscription-code-in-your-form" id="add-the-subscription-code-in-your-form"></a>

Once clicked on the link/button, a popup will appear.

Click on the **Submit Pieces** link and in the **End Submit** area, click on the **Custom** choice

![](https://4212440522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_D4iy53WFAtKVs3BPA%2F-MJWDIW14HYGp_iv2IIH%2F-MJWDTGdAo3B79fq8NFm%2Fbreezingforms_endsubmit.png?alt=media\&token=60a72e46-9eb2-404f-9563-5aebf38704de)

```
 $this->execPieceByName('ff_InitLib');
 include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
 $myUser = new stdClass();
 $myUser->email = strip_tags(ff_getSubmit('email_field')); //Please replace email_field by your own field name (the name of the field "email").
 $myUser->name = strip_tags(ff_getSubmit('name_field')); //Please replace name_field by your own field name (the name of the field "name").
 $subscriberClass = acymailing_get('class.subscriber');
 $subid = $subscriberClass->save($myUser);
 $subscriberClass->sendConf($subid); //we send the confirmation email... only if needed based on the current user status and the option from the Acy configuration page. 
 $subscribe = array(3,4,5); //Specify here the ID of your lists separated by a comma, in this example the user will be subscribed to lists IDs 3,4 and 5. 
 $newSubscription = array(); 
 if(!empty($subscribe)){
    foreach($subscribe as $listId){
       $newList = array();
       $newList['status'] = 1;
       $newSubscription[$listId] = $newList;
    }
 }
 $subscriberClass->saveSubscription($subid,$newSubscription);
```

Please make sure to replace the fields name based on your form configuration and enter the IDs of your own lists.

### Subscribe the user only if the user checks the box <a href="#subscribe-the-user-only-if-the-user-checks-the-box" id="subscribe-the-user-only-if-the-user-checks-the-box"></a>

You can create a checkbox on your form and then only subscribe the user if he checks that box.

Please add this part only if the previous code works fine.

Once your checkbox created (let's call the checkbox "subscribeme" ), add this code at the top of the previous code:

```
$this->execPieceByName('ff_InitLib');
if(!ff_getSubmit('subscribeme')) return;
```


---

# 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/old/developers/subscription-via-url/breezingforms-and-acymailing.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.
