All Projects → danesparza → Mailchimp.net

danesparza / Mailchimp.net

Licence: mit
✉️ .NET Wrapper for the MailChimp v2.0 API

Labels

Projects that are alternatives of or similar to Mailchimp.net

Airform
Functional HTML forms for Front-End Developers.
Stars: ✭ 307 (+69.61%)
Mutual labels:  mailchimp
Cookiecutter Pyramid Talk Python Starter
An opinionated Cookiecutter template for creating Pyramid web applications starting way further down the development chain. This cookiecutter template will create a new Pyramid web application with email, sqlalchemy, rollbar, and way more integrated.
Stars: ✭ 64 (-64.64%)
Mutual labels:  mailchimp
Mailchimp Subscribe Craft
Simple Craft plugin for subscribing to a MailChimp list.
Stars: ✭ 117 (-35.36%)
Mutual labels:  mailchimp
Chronicel
Our super sweet hacker management system, built for HackTCNJ 2017+ | Used by [email protected] 2018!
Stars: ✭ 18 (-90.06%)
Mutual labels:  mailchimp
Mailchimp Boilerplate
MailChimp repeatable blocks boilerplate
Stars: ✭ 56 (-69.06%)
Mutual labels:  mailchimp
Laravel Newsletter
Manage newsletters in Laravel
Stars: ✭ 1,318 (+628.18%)
Mutual labels:  mailchimp
Magento2 Gmail Smtp App
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers
Stars: ✭ 281 (+55.25%)
Mutual labels:  mailchimp
Mailchimp Api
Super-simple, minimum abstraction MailChimp API v3 wrapper, in PHP
Stars: ✭ 1,977 (+992.27%)
Mutual labels:  mailchimp
Mailchimp Api 3.0 Php
A feature rich object-oriented PHP library for interacting with MailChimp's API v3 💌🐵
Stars: ✭ 61 (-66.3%)
Mutual labels:  mailchimp
Mailchimp For Wordpress
The #1 Mailchimp plugin for WordPress
Stars: ✭ 111 (-38.67%)
Mutual labels:  mailchimp
Ecommerce
We're going to take you step-by-step to build a modern, fully open-source, eCommerce web application using Python, Django, Bootstrap, Javascript, and more.
Stars: ✭ 980 (+441.44%)
Mutual labels:  mailchimp
Gochimp3
🐒 Golang client for MailChimp API 3.0.
Stars: ✭ 39 (-78.45%)
Mutual labels:  mailchimp
Formeditor
A form builder editor for Umbraco 7 - let your editors build forms easily with this free package.
Stars: ✭ 95 (-47.51%)
Mutual labels:  mailchimp
Email Templates
Free HTML email templates for Mailchimp and other emails services
Stars: ✭ 457 (+152.49%)
Mutual labels:  mailchimp
Gatsby Plugin Mailchimp
A simple, lightweight Gatsby plugin to subscribe new email addresses to your Mailchimp list
Stars: ✭ 125 (-30.94%)
Mutual labels:  mailchimp
Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+1718.23%)
Mutual labels:  mailchimp
Mailchimp Api Php
PHP library for v3 of the MailChimp API.
Stars: ✭ 75 (-58.56%)
Mutual labels:  mailchimp
React Mailchimp Subscribe
React subscribe form for Mailchimp.
Stars: ✭ 170 (-6.08%)
Mutual labels:  mailchimp
Trado
Trado is a lightweight, easy to use ecommerce platform; designed to allow developers to quickly deploy a premium ecommerce store for their business
Stars: ✭ 149 (-17.68%)
Mutual labels:  mailchimp
Formchimp
A customizable MailChimp ajax plugin for jQuery
Stars: ✭ 98 (-45.86%)
Mutual labels:  mailchimp

MailChimp.NET Build status deprecated

.NET Wrapper for the MailChimp v2.0 API, built with MailChimp love ❤️

Note: This is for the 2.0 API (which is now deprecated). If you'd like a client for the 3.0 API, check out this one by Brandon Seydel

Quick Start

Install the NuGet package from the package manager console:

Install-Package MailChimp.NET

Next, you will need to provide MailChimp.NET with your API key in code. Need help finding your API key? Check here: http://kb.mailchimp.com/article/where-can-i-find-my-api-key

In your application, call:

// Pass the API key on the constructor:
MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");

// Next, make any API call you'd like:
ListResult lists = mc.GetLists();

Getting help

For help and support, first check out the examples below.

If you can't figure out what you need from the examples (or if you're running into a tough problem) you might want to check out the MailChimp support site, or ping the MailChimp API support twitter account.

If you've got a question/bug/feature request for the API wrapper itself, please use Github issues and consider contributing to the project yourself. See the "Making contributions" section for more information on how to contribute.

Examples

Getting the first 100 users in each list:
using MailChimp;
using MailChimp.Lists;
using MailChimp.Helper;

MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");
ListResult lists = mc.GetLists();

//  For each list
foreach(var list in lists.Data)
{
    //  Write out the list name:
	Debug.WriteLine("Users for the list " + list.Name);
	
	//  Get the first 100 members of each list:
	MembersResult results = mc.GetAllMembersForList(list.Id, "subscribed", 0, 100);
	
	//  Write out each member's email address:
	foreach(var member in results.Data)
	{
	    Debug.WriteLine(member.Email);
	}
}
Subscribe an email address to a list:
MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");

//	Create the email parameter
EmailParameter email = new EmailParameter()
{
	Email = "[email protected]"
};

EmailParameter results = mc.Subscribe("YourListID", email);
Subscribe an email address to a list and set their interest groups (custom merge variables):
// optionally create a class that inherits MergeVar and add any additional merge variable fields:
[System.Runtime.Serialization.DataContract]
public class MyMergeVar : MergeVar
{
	[System.Runtime.Serialization.DataMember(Name = "FNAME")]
	public string FirstName { get; set; }
	[System.Runtime.Serialization.DataMember(Name = "LNAME")]
	public string LastName { get; set; }
}

MyMergeVar myMergeVars = new MyMergeVar();
myMergeVars.Groupings = new List<Grouping>();
myMergeVars.Groupings.Add(new Grouping());
myMergeVars.Groupings[0].Id = 1234; // replace with your grouping id
myMergeVars.Groupings[0].GroupNames = new List<string>();
myMergeVars.Groupings[0].GroupNames.Add("Your Group Name");
myMergeVars.FirstName = "Testy";
myMergeVars.LastName = "Testerson";

MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");

//	Create the email parameter
EmailParameter email = new EmailParameter()
{
	Email = "[email protected]"
};

EmailParameter results = mc.Subscribe("YourListID", email, myMergeVars);

// or use the Dictionary to specify the fields and values. 
// GetMemberInfo will always return the fields and values using the dictionary and not the custom class.
MergeVar myMergeVars = new MergeVar();
myMergeVars.Groupings = new List<Grouping>();
myMergeVars.Groupings.Add(new Grouping());
myMergeVars.Groupings[0].Id = 1234; // replace with your grouping id
myMergeVars.Groupings[0].GroupNames = new List<string>();
myMergeVars.Groupings[0].GroupNames.Add("Your Group Name");
myMergeVars.Add("FNAME", "Testy");
myMergeVars.Add("LNAME", "Testerson");

MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");

//	Create the email parameter
EmailParameter email = new EmailParameter()
{
	Email = "[email protected]"
};

EmailParameter results = mc.Subscribe("YourListID", email, myMergeVars);

Getting location data for each list:
MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");
ListResult lists = mc.GetLists();

//  For each list
foreach(var list in lists.Data)
{
	Debug.WriteLine("Information for " + list.Name);
	
	//  Get the location data for each list:
	List<SubscriberLocation> locations = mc.GetLocationsForList(list.Id);
	
	//  Write out each of the locations:
	foreach(var location in locations)
	{
	    Debug.WriteLine("Country: {0} - {2} users, accounts for {1}% of list subscribers", location.Country, location.Percent, location.Total);
	}
}

Mocking

The IMailChimpManager and IMailChimpExportManager interfaces have been included to allow you to easily mock this API for your own testing.

To set up in your dependency injector, bind the interface with a constructor argument passing your API key. This example uses Ninject loading the value from an app setting in the Web.config named 'MailChimpApiKey':

kernel.Bind<IMailChimpManager>()
	.To<MailChimpManager>()
	.WithConstructorArgument("apiKey", ConfigurationManager.AppSettings["MailChimpApiKey"]);

If you were to use a framework like Moq you might write something like:

public class ThingThatDependsOnMailChimpManager{
	IMailChimpManager _mailChimpManager;

	public ThingThatDependsOnMailChimpManager(IMailChimpManager mailChimpManager){
		_mailChimpManager = mailChimpManager;
	}

	public bool DoSomething(){
		_mailChimpManager.UpdateCampaign("campaignId", "name", new object());
		return true;
	}
}
// Arrange
Mock<IMailChimpManager> mailChimpManagerMock = new Mock<IMailChimpManager>();

mailChimpManagerMock.Setup(x => x.UpdateCampaign(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>())
.Return(new CampaignUpdateResult());

// Act
var thing = new ThingThatDependsOnMailChimpManager(mailChimpManagerMock.Object);
var result = thing.DoSomething();

// Assert
Assert.IsTrue(result);

Making contributions

This project is not affiliated with MailChimp. All contributors to this project are unpaid average folks (just like you!) who choose to volunteer their time. If you like MailChimp and want to contribute, we would appreciate your help! To get started, just fork the repo, make your changes and submit a pull request.

Also: If you're reading this and you're from MailChimp, we wouldn't mind some swag.

Status

Here is the progress so far (according to the MailChimp API docs ) :

Overall: 71% (85 of 120)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].