External subscription form

By default AcyMailing will install a subscription module so you can simply publish it and configure it to get a subscription form on your website.

But if you want to add a subscription form on another website or on your facebook page, then you will need an external subscription form.

iframe integration

If your other website enables you to include an iframe, the easiest way to embed your subscription form on that other website is to use this method:

Create an AcyMailing subscription module on your own website and configure it the way you want (with captcha, extra fields, terms and conditions...) Copy the ID of that module and then on your other website, create an iframe to display this module:

<iframe src="http://www.YOURWEBSITE.COM/index.php?option=com_acymailing&ctrl=sub&task=display&tmpl=component&formid=YOUR_MODULE_ID" height="YOUR_HEIGHT" frameborder="0" width="100%" ></iframe>

Please make sure to replace your website url, your module id and the iframe height with the right values.

We recommend you to set the module redirection to "ajax".

With this system you can integrate your Newsletter subscription module to your Facebook page, so that all your fans can subscribe to your newsletter directly from Facebook.

Default subscription form

The standard code is:

<form action="http://YOURWEBSITE/index.php?option=com_acymailing&ctrl=sub" 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><label for="user_html">Receive</label></td>
			<td>
				<input type="radio" name="user[html]" value="0" id="user_html_0">
				<label for="user_html_0">Text</label>
				<input type="radio" name="user[html]" value="1" id="user_html_1" checked="checked"><label for="user_html_1">HTML</label>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<input class="button" type="submit" value="Subscribe" name="Submit" />
			</td>
		</tr>
	</table>
	<input type="hidden" name="acyformname" value="formAcymailing1" />
	<input type="hidden" name="ctrl" value="sub" />
	<input type="hidden" name="task" value="optin" />
	<input type="hidden" name="redirect" value="http://YOUR_REDIRECT_URL" />
	<input type="hidden" name="option" value="com_acymailing" />
	<input type="hidden" name="visiblelists" value="" />
	<input type="hidden" name="hiddenlists" value="YOUR_LISTS" />
</form>

Don't forget to:

  • Replace YOURWEBSITE by the url of your own website!

  • YOUR_REDIRECT_URL by the url of your redirect url

  • YOUR_LISTS by your lists IDs separated by comma. For example if you want the user to be subscribed to your list ID 3 and ID 4 then you should specify 3,4

Add a captcha to your form

If you use one of our commercial versions, you can turn ON the captcha feature on the AcyMailing configuration page and then add a captcha to your subscription form:

<img class="captchaimagemodule" src="http://YOURWEBSITE/index.php?option=com_acymailing&ctrl=captcha&acyformname=formAcymailing1&val=5753" alt="captcha" /> 
<input id="user_captcha_formAcymailing1" class="inputbox captchafield" type="text" name="acycaptcha" size="5" />

Again, don't forget to replace YOURWEBSITE by the url of your own website.

So the whole subscription form code will be:

<form action="http://YOURWEBSITE/index.php?option=com_acymailing&ctrl=sub" 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><label for="user_html">Receive</label></td>
			<td><input type="radio" name="user[html]" value="0" id="user_html_0"><label for="user_html_0">Text</label><input type="radio" name="user[html]" value="1" id="user_html_1" checked="checked"><label for="user_html_1">HTML</label></td>
		</tr>
		<tr>
			<td><img class="captchaimagemodule" src="http://YOURWEBSITE/index.php?option=com_acymailing&ctrl=captcha&acyformname=formAcymailing1&val=5753" alt="captcha" id="captcha_picture" /></td>
			<td><input id="user_captcha_formAcymailing1" class="inputbox captchafield" type="text" name="acycaptcha" size="5" /></td>
		</tr>
		<tr>
			<td colspan="2"><input class="button" type="submit" value="Subscribe" name="Submit" /></td>
		</tr>
	</table>
	<input type="hidden" name="acyformname" value="formAcymailing1" /> 
	<input type="hidden" name="ctrl" value="sub" /> 
	<input type="hidden" name="task" value="optin" /> 
	<input type="hidden" name="redirect" value="http://YOUR_REDIRECT_URL" /> 
	<input type="hidden" name="option" value="com_acymailing" /> 
	<input type="hidden" name="visiblelists" value="" /> 
	<input type="hidden" name="hiddenlists" value="YOUR_LISTS" />
</form>

If you enabled the captcha on your website but you want to use the external subscription form without captcha, then insert the "security key" (displayed on the AcyMailing configuration page, in the captcha area) in an hidden field in your form:

<input type="hidden" name="seckey" value="COPY_YOUR_SECURITY_KEY_VALUE_HERE" />

If you want to add an image to refresh the captcha picture, add the following code where you want to display it in the previous code. Note that you need to add the URL of the picture you want to use (replace YOUR_RELOAD_PICTURE):

<img onclick="document.getElementById('captcha_picture').src=document.getElementById('captcha_picture').src+'0';" src="YOUR_RELOAD_PICTURE"/>

Add custom fields to your form

If you use AcyMailing Enterprise and created some custom fields, you can also add them to your external subscription form.

Each field should be added using the code:

<input name="user[YOUR_CUSTOM_FIELD_COLUMN_NAME]" />

Since AcyMailing 3.6.0, you can edit your custom field and directly copy/paste the html code to include it in your external subscription form.

Display your lists on the form

If you want the user to select the lists he should be subscribed to, you can display them on your form with that code. Please make sure the IDs of these lists are not in the hiddenlists parameter.

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

Add a "terms and conditions" checkbox

You can add a "terms and conditions" checkbox using this code:

<form action="http://YOURWEBSITE/index.php?option=com_acymailing&ctrl=sub" onsubmit="if(!this.terms.checked){alert('Please accept our terms and conditions');return false;}" 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><label for="user_html">Receive</label></td>
			<td><input type="radio" name="user[html]" value="0" id="user_html_0"><label for="user_html_0">Text</label><input type="radio" name="user[html]" value="1" id="user_html_1" checked="checked"><label for="user_html_1">HTML</label></td>
		</tr>
		<tr>
		<tr>
			<td colspan="2"><input type="checkbox" value="1" name="terms" /><a href="linktoyourterms">Terms and conditions</a></td>
		</tr>
		<tr>
			<td colspan="2"><input class="button" type="submit" value="Subscribe" name="Submit" /></td>
		</tr>
	</table>
	<input type="hidden" name="acyformname" value="formAcymailing1" /> 
	<input type="hidden" name="ctrl" value="sub" /> 
	<input type="hidden" name="task" value="optin" /> 
	<input type="hidden" name="redirect" value="http://YOUR_REDIRECT_URL" /> 
	<input type="hidden" name="option" value="com_acymailing" /> 
	<input type="hidden" name="visiblelists" value="" /> 
	<input type="hidden" name="hiddenlists" value="YOUR_LISTS" />
</form>

Last updated