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.
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:
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.
You can modify the text of the link with the "Text" option, "Subscribe" is written by default.
Subscription via URL
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"
If you want to use a direct subscription link somewhere on your site, or even another site, you can use this link:
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.
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
External subscription form
Sometimes you need to create a form on another website. If this is your case, you can use the following code:
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]:
You can let the users choose their lists by adding inputs like this:
<inputtype="checkbox"name="subscription[]"value="3"/>My List with ID 3<br/><inputtype="checkbox"name="subscription[]"value="7"/>My List with ID 7<br/><inputtype="checkbox"name="subscription[]"value="14"/>My List with ID 14<br/>
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: