I have successfully implemented subscriptions with MailChimp.net but it is email only. Does anyone have an example of how to pass firstname and lastname when subscribing?

有帮助吗?

解决方案 2

Create your own MergeVar and use it in the Subscribe method

[DataContract]
public class CustomMergeVar : MergeVar
{
    [DataMember(Name = "FNAME")]
    public string FirstName { get; set; }

    [DataMember(Name = "LNAME")]
    public string LastName { get; set; }

    [DataMember(Name = "ORGANIS")]
    public string Organisation { get; set; }
}

其他提示

Create a new instance of MergeVar and simply add the list field tag (key) along with its value.

Then pass the MergeVar instance as a parameter into the Subscribe method.

MailChimpManager mc = new MailChimpManager("API Key");

EmailParameter emailParam = new EmailParameter()
{
    Email = HttpUtility.HtmlEncode(email)
};

MergeVar mV = new MergeVar();
mV.Add("FNAME", HttpUtility.HtmlEncode(firstName));
mV.Add("LNAME", HttpUtility.HtmlEncode(lastName));
EmailParameter results = mc.Subscribe("List ID", emailParam, mV);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top