如何将MailChimp集成到C#/。网络中
题
我想通过MailChimp发送电子邮件。如何在.NET中执行此操作?
有人有示例代码吗?
谢谢。
解决方案
看看Codeplex上的感知摄氏:
Conceptivemcapi-一个.NET友好的包装器,用于MailChimp API用C#编写的感知逻辑。
其他提示
下面的示例将发送选择加入电子邮件:
首先安装nuget软件包:install-pakcage 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();
}
为了支持 最新的 邮件黑猩猩3.0 API, ,您可以找到.net上的包装器:
MailChimp.net-邮件黑猩猩3.0包装纸
您可以在Codeplex上尝试一下:
请结帐 https://github.com/danesparza/mailchimp.net 经过 丹·埃斯帕尔扎(Dan Esparza)您可以使用 软件包管理器控制台
Install-Package MailChimp.NET
代码示例
MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2"); ListResult lists = mc.GetLists();
为了 电子邮件发送 和统计 mailchimp 优惠 曼德里尔 经过 肖恩·麦克莱恩(Shawn McLean) https://github.com/shawnmclean/mandrill-dotnet
您可以使用Mandrill使用
Install-Package Mandrill
代码示例
MandrillApi api = new MandrillApi("xxxxx-xxxx-xxxx-xxxx"); UserInfo info = await api.UserInfo();
不隶属于 StackOverflow