summaryrefslogtreecommitdiff
path: root/bin/xmlrpc-email_opt_out
blob: f8c6713c90f80a96f67314ea192241fcbb833a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env perl

use strict;
use warnings;
use Frontier::Client;

my $uri = new URI 'http://localhost:8008/';

my $server = new Frontier::Client ( 'url' => $uri );

my $secret = 'sharingiscaring';

die "
Usage:
  xmlrpc-email_opt_out email\@address.com email\@address.net ...

" unless @ARGV && $ARGV[0] =~ /\@/;


for my $address (@ARGV) {

  my $response = $server->call('FS.API.email_opt_out',
    # API shared secret
    secret => $secret,

    # E-Mail address
    address => $address,

    #   Do not clear the invoice_dest field:
    # disable_invoice_dest => 0,

    #   Do not clear the message_dest field:
    # disable_message_dest => 0,
  );

  if ($response->{error}) {
    print "$response->{error} \n";
  } else {
    print "opt-out: $address \n";
  }
}


1;