diff options
author | Mitch Jackson <mitch@freeside.biz> | 2018-02-13 20:44:18 -0600 |
---|---|---|
committer | Mitch Jackson <mitch@freeside.biz> | 2018-02-13 20:44:18 -0600 |
commit | e4829d1025798f30b0af30d1e22da2f7c769df31 (patch) | |
tree | bab8592dbc4b5abe4bb93d71bd35d9b412287e69 /bin/xmlrpc-email_opt_out | |
parent | d2b55d07a9e6e64a38877136d7974ab93e14f1ed (diff) |
RT# 77217 Add email_opt_out action to API
Diffstat (limited to 'bin/xmlrpc-email_opt_out')
-rwxr-xr-x | bin/xmlrpc-email_opt_out | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/bin/xmlrpc-email_opt_out b/bin/xmlrpc-email_opt_out new file mode 100755 index 0000000..f8c6713 --- /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; |