購読取り消しページの作成

ユーザーがメーリングリストの購読を取り消したときに表示する Web ページにこのスクリプトを挿入します。

1<script runat="server">
2    Platform.Load("Core","1");
3
4    // get all the submitted values from the front end
5    // verify first that we have an email passed as a parameter,
6    //otherwise the form may have been called from some other means and won't function without needed parameters
7    var email = Request.GetFormField("email");
8    if (Stringify(email) != "null" && email != ''){
9
10        //Get the list ID from the calling form
11        var ListID = Request.GetFormField("listid");
12
13        if (Stringify(ListID) != "null" && ListID != ''){
14
15            var lists = List.Retrieve({Property:"ID",SimpleOperator:"equals",Value:ListID});
16            var listKey = lists[0].CustomerKey;
17            var myList = List.Init(listKey);
18
19            var status = myList.Subscribers.Unsubscribe(email);
20
21            if (status == "OK") {
22            } else {
23            }
24        }
25    }
26</script>