# Other subscription methods

The easiest way to let users subscribe to your newsletters is to activate the default AcyMailing subscription form (WP Widget or Joomla module), but in some cases you may need other solutions.

{% tabs %}
{% tab title="Link in an email" %}

## Subscribe link in an email

You can easily insert a direct subscribe link in your emails with the dynamic text feature. First, insert a text zone then click in it:

![](https://963725040-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_D4iy53WFAtKVs3BPA%2F-MVaiWDgYsQYidXV8v3C%2F-MVajdUN3g4AwBwCsoAo%2Fdtext%20text.png?alt=media\&token=efd78b57-31a9-4fe5-9930-ba0eb7ed344e)

On the right of the editor, the dynamic text selection zone appears. Under the tab "Subscription", click the "Insert a subscribe link in your email" option, select the lists you want the user to be subscribed to when clicking the link, then click the "Insert dynamic text" button.

![](https://963725040-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L_D4iy53WFAtKVs3BPA%2F-MVaiWDgYsQYidXV8v3C%2F-MVakR85ZkTEKOCdB308%2Fdtext%20steps.png?alt=media\&token=a5dcf357-799d-44cd-8aed-6eec7b5d9f29)

You can modify the text of the link with the "Text" option, "Subscribe" is written by default.
{% endtab %}

{% tab title="Subscription via URL" %}

## Subscription via URL

{% hint style="warning" %}
First of all, make sure to allow non logged-in users to subscribe in the configuration page, tab "Subscription", option "Allow user data modifications without identification"
{% endhint %}

If you want to use a direct subscription link somewhere on your site, or even another site, you can use this link:

Joomla websites

```
https://www.example.com/index.php?option=com_acym&ctrl=frontusers&task=subscribe&hiddenlists=1,3&user[email]=email@example.com
```

WordPress websites

```
https://www.example.com/index.php?page=acymailing_front&ctrl=frontusers&task=subscribe&hiddenlists=1,3&user[email]=email@example.com&action=acymailing_frontrouter&noheader=1
```

In these links, you have to replace "1,3" by the IDs of the lists (you can see them on the AcyMailing contact lists' listing page on the right).\
<email@example.com> has to be replaced by the email address of the user.

For new users, you can add "\&user\[confirmed]=1" to make sure they're created as confirmed, if this is what you want to do.

### Redirection after subscription

You can add a "redirect" parameter to your link so that AcyMailing will subscribe the user and then redirect the user to the specified url. \
\&#xNAN;*Example : &**redirect=http%3A%2F%2Fwww\.google.com*** \
All submitted data should be in utf-8 and url-encoded (using the php function urlencode() for example).

* \= should be replaced by %3D
* & should be replaced by %26
* ? should be replaced by %3F
* / should be replaced by %2F
* : should be replaced by %3A
  {% endtab %}

{% tab title="External subscription form" %}

## External subscription form

Sometimes you need to create a form on another website. If this is your case, you can use the following code:

### Joomla websites

{% code lineNumbers="true" %}

```html
<form action="https://EXAMPLE/index.php" method="post">
	<table class="acymailing_form">
		<tr>
			<td><label for="user_name">Name</label></td>
			<td><input id="user_name" type="text" name="user[name]" value="" /></td>
		</tr>
		<tr>
			<td><label for="user_email">E-mail</label></td>
			<td><input id="user_email" type="text" name="user[email]" value="" /></td>
		</tr>
		<tr>
			<td colspan="2"><input class="button" type="submit" value="Subscribe" name="Submit" /></td>
		</tr>
	</table>

	<input type="hidden" name="ctrl" value="frontusers" />
	<input type="hidden" name="task" value="subscribe" />
	<input type="hidden" name="redirect" value="https://YOUR_REDIRECT_URL" />
	<input type="hidden" name="hiddenlists" value="YOUR_LISTS" />

	<input type="hidden" name="option" value="com_acym" />
</form>
```

{% endcode %}

### WordPress websites

{% code lineNumbers="true" %}

```html
<form action="https://EXAMPLE/index.php" method="post">
	<table class="acymailing_form">
		<tr>
			<td><label for="user_name">Name</label></td>
			<td><input id="user_name" type="text" name="user[name]" value="" /></td>
		</tr>
		<tr>
			<td><label for="user_email">E-mail</label></td>
			<td><input id="user_email" type="text" name="user[email]" value="" /></td>
		</tr>
		<tr>
			<td colspan="2"><input class="button" type="submit" value="Subscribe" name="Submit" /></td>
		</tr>
	</table>

	<input type="hidden" name="ctrl" value="frontusers" />
	<input type="hidden" name="task" value="subscribe" />
	<input type="hidden" name="redirect" value="https://YOUR_REDIRECT_URL" />
	<input type="hidden" name="hiddenlists" value="YOUR_LISTS" />

	<input type="hidden" name="page" value="acymailing_front" />
	<input type="hidden" name="action" value="acymailing_frontrouter" />
	<input type="hidden" name="noheader" value="1" />
</form>
```

{% endcode %}

In both cases, don't forget to replace the following strings:

* EXAMPLE: by the website on which AcyMailing is installed, it will collect the form's data
* YOUR\_LISTS: by the IDs of the lists separated by a coma. The user won't see these lists.
* YOUR\_REDIRECT\_URL: this input is actually optional, you can specify any URL here

### Add custom fields

Custom fields can also be added in the form. You need to get the ID of the field from the custom fields listing (or in the database column "id" of table "xxx\_acym\_field"). Then use it to replace *id* in *customField\[id]*:

{% code lineNumbers="true" %}

```html
<tr>
	<td><label for="user_field">My field</label></td>
	<td><input id="user_field" type="text" name="customField[id]" value="" /></td>
</tr>
```

{% endcode %}

### Display the lists

You can let the users choose their lists by adding inputs like this:

{% code lineNumbers="true" %}

```html
<input type="checkbox" name="subscription[]" value="3"/>My List with ID 3<br/>
<input type="checkbox" name="subscription[]" value="7"/>My List with ID 7<br/>
<input type="checkbox" name="subscription[]" value="14"/>My List with ID 14<br/>
```

{% endcode %}

### The captcha blocks the form

If you activated the captcha in the AcyMailing configuration page, tab "Security", you will need to add the following input in your form with the "Security key" value of the same page:

{% code lineNumbers="true" %}

```html
<input type="hidden" name="seckey" value="SECURITY_KEY_VALUE" />
```

{% endcode %}

{% hint style="warning" %}
Adding this input won't add an invisible recaptcha, it's just a security to prevent anyone from creating an external form redirecting to your website.
{% endhint %}
{% endtab %}
{% endtabs %}
