X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Fxmlrpc-email_opt_out;fp=bin%2Fxmlrpc-email_opt_out;h=f8c6713c90f80a96f67314ea192241fcbb833a21;hb=e4829d1025798f30b0af30d1e22da2f7c769df31;hp=0000000000000000000000000000000000000000;hpb=d2b55d07a9e6e64a38877136d7974ab93e14f1ed;p=freeside.git diff --git a/bin/xmlrpc-email_opt_out b/bin/xmlrpc-email_opt_out new file mode 100755 index 000000000..f8c6713c9 --- /dev/null +++ b/bin/xmlrpc-email_opt_out @@ -0,0 +1,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;