ColdFusion Sendy API Subscribe

Adding an email to your Sendy list is extremely simple using Sendy's API.
<!--- THE HTML --->
<form action="/components/email.cfc?method=subscribe" method="POST">
	<input type="email" name="email" placeholder="Enter email address">
</form>


<!--- The ColdFusion Function --->
<cffunction name="subscribe" access="remote" returnformat="plain" returntype="string" output="false">
	<cfargument name="email" required="true" type="string">
	
	<cfset var listId = "YOUR_ENCRYPTED_LIST_ID">
	
	<cfhttp method="POST" url="http://YOUR_SENDY_URL/subscribe">
		<cfhttpparam name="email" value="#arguments.email#" type="formfield">
		<cfhttpparam name="list" value="#listId#" type="formfield">
		<cfhttpparam name="boolean" value="true" type="formfield">
	</cfhttp>
	
	<!--- redirect back to page --->
	<cflocation url="/optin.php?msg=#cfhttp.FileContent#">
</cffunction>
Posted by
Snippet Viewed 3041 times.

Share your ColdFusion code snippets:

  • Get some recognition & a link back to your site.
  • Create your own code library.
  • Help your fellow developers, as they have helped you.

 

Submit | Browse

Most Recent coldfusion snippets

Most Viewed