Wah*_*eed 21 c# asp.net mailchimp
我想通过MailChimp发送电子邮件.如何在.Net中这样做?
有没有人有示例代码?
谢谢.
Fer*_*ali 16
以下示例将发送选择加入电子邮件:
首先安装NuGet包:Install-Package mcapi.net
static void Main(string[] args)
{
const string apiKey = "6ea5e2e61844608937376d514-us2"; // Replace it before
const string listId = "y657cb2495"; // Replace it before
var options = new List.SubscribeOptions();
options.DoubleOptIn = true;
options.EmailType = List.EmailType.Html;
options.SendWelcome = false;
var mergeText = new List.Merges("email@provider.com", List.EmailType.Text)
{
{"FNAME", "John"},
{"LNAME", "Smith"}
};
var merges = new List<List.Merges> { mergeText };
var mcApi = new MCApi(apiKey, false);
var batchSubscribe = mcApi.ListBatchSubscribe(listId, merges, options);
if (batchSubscribe.Errors.Count > 0)
Console.WriteLine("Error:{0}", batchSubscribe.Errors[0].Message);
else
Console.WriteLine("Success");
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
Ira*_*ney 14
看看CodePlex上的PerceptiveMCAPI:
PerceptiveMCAPI - Perceptive Logic用C#编写的MailChimp Api的.NET友好包装器.
http://perceptivemcapi.codeplex.com/
为了支持最新的 Mail Chimp 3.0 API,您可以在.Net上找到包装:
MailChimp.Net - 邮件黑猩猩3.0包装
https://github.com/brandonseydel/MailChimp.Net