전자 메일 목록에 가입하려면 MailChimp API를 사용하고 있습니다. 기능 listsubscribe() 이메일 가입에 대한 사용됩니다Php 2d 배열을 C# 2d 배열/구조체로
listSubscribe(string apikey, string id, string email_address, MCMergeVar[] merges)
것은 내가 클릭
public static listSubscribe(string apikey, string id, string email_address, array merge_vars, string email_type, boolean double_optin, boolean update_existing, boolean replace_interests, boolean send_welcome)
내가
Visual Studio에서 찾고,이 오버로드 기능 중 하나입니다 그들의 API에 대한 메일 침프의 공식 .NET wrapper 다운로드 MCMergeVar []의 정의에서 이것은 다음과 같이 나온다 :
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct MCMergeVar
{
public string name;
public bool req;
[XmlRpcMissingMapping(MappingAction.Error)]
public string tag;
public string val;
}
메일 침프의 웹 사이트에 PHP의 예에서
,이 merges
변수를 선언하는 방법입니다
$merge_vars = array('FNAME'=>'Test', 'LNAME'=>'Account', 'INTERESTS'=>'');
어떻게 내 C# 래퍼에 대해 올바르게 배열을 작성? 나는 이런 식으로 뭔가 시도 ... 사전에
감사합니다, 일드를
MCMergeVar[] subMergeVars = new MCMergeVar[1];
subMergeVars["FNAME"] = "Test User";
을하지만 "FNAME"
지금 배치 장소에 int
필요하므로이 작동하지 않습니다
EDIT 1 : FoxFire의 솔루션을 사용해 보았지만 subMergeVars의 데이터는 MailChimp 서버로 전달되지 않고 전자 메일 만 전달됩니다.
// Subscribe email to list
string subID = "26973e52cc";
string subEmail = "[email protected]";
MCMergeVar[] subMergeVars = new MCMergeVar[5];
subMergeVars[0].name = "FNAME";
subMergeVars[0].val = "FNDynamic";
subMergeVars[1].name = "LNAME";
subMergeVars[1].val = "LNDynamic";
mailChimp.api.listSubscribe(subID, subEmail, subMergeVars, "html");
그것은 나에게 좋아 보이지만, 데이터가 여전히 메일 침프 서버로 전달되지 않습니다 .. . 이제 시도한 예제로 내 질문을 편집 할 것입니다. –
알아 냈습니다 ... .name은 .val로 대체해야하며 잘 작동합니다. :) 감사! –
".name은 .val로 대체해야합니다."라는 의미가 분명하지 않습니다. 스 니펫을 게시 할 수 있습니까? –