Using MailChimp with uSkinned Newsletter Signup Form

I am currently working on a new Umbraco site for The World Organization for Positive Action. I have chosen to use a uSkinned theme as it’s a great way to quickly implement a site. One of the features of the uSkinned theme is a newsletter signup form that integrates with Campaign Monitor. The World Organization for Positive Action, however, uses MailChimp for managing their email subscribers. Fortunately, it is quite easy to modify the uSkinned theme to use MailChimp instead of Campaign Monitor.



First, I installed MailChimp.NET, a .NET wrapper for the MailChimp v2.0 AP, via NuGet. Next, I modified the newsletter signup controller (\App_Code\USNControllers\NewsletterSignupSurfaceController.cs) by replacing the Campaign Monitor code with the following code:

var mc = new MailChimpManager( globalSettings.GetProperty("campaignMonitorAPIKey").Value.ToString() );

var email = new EmailParameter()

{

Email = model.Email

};



var myMergeVars = new MergeVar();

myMergeVars.Add("FNAME", model.FirstName);

myMergeVars.Add("LNAME", model.LastName);



EmailParameter results = mc.Subscribe(subsciberListID, email, myMergeVars, "html", false, true, false, true);

Note that I re-purpose the Campaign Monitor settings that come with the uSkinned theme including the subscriberListID variable. I also hard coded a few parameters for the MailChimp subscribe method. The last four parameters are booleans for setting double opt-in, update existing, replace interests, and send welcome (see MailChimp API docs for details.)





Please enable JavaScript to view the comments powered by Disqus.