Frage

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?

War es hilfreich?

Lösung 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; }
}

Andere Tipps

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);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top