Support - No-IP Support Center

Email Clients and Servers Support Guides
RSS Guides feed

Synchronizing remote accounts for Backup and Reflector

Backup and Reflector customers should keep a list of valid email recipients updated with No-IP.com, letting No-IP refuse mail to invalid recipients at the SMTP level. This means less processing overhead for your mail server and No-IP's, as well as less spam. And it is a good thing to do for the Internet community at large.

No-IP.com has a simple interface for synchronizing your valid recipients. Just POST a comma separated list to the URL below.

URL: http://www.no-ip.com/members/mail/remoteaccts-rpc.php
Required variables:

  • email - the email address you use to log into No-IP.com.
  • password - the password you use to log into No-IP.com.
  • domain - the domain that the list applies to.
  • action - can be REPLACEALL, APPEND, REMOVE.
  • accounts - a comma separated list of accounts without the domain part.

Here is a simple example script using curl:

sync-accounts.sh

#!/bin/sh

EMAIL="user@no-ip.com"
PASSWORD="ExamplePassword"
DOMAIN="domain.com"

tr "\n" ',' | xargs printf \
  "email=${EMAIL}&password=${PASSWORD}&domain=${DOMAIN}&action=REPLACEALL&accounts=%s" \
  | curl --data @- https://www.no-ip.com/members/mail/remoteaccts-rpc.php

Basically, this script changes the one-item-per-line input list into a comma separated list then passes it to printf to format a URI for curl to POST. Arguments should really be run through a URI encoder, but I wanted this to be as simple as possible. If you have funky characters in your password or addresses, you'll need to encode it.

Say you have your list of recipients in accounts.txt, one per line, whenever you want to synchronize your valid recipients just run:

./sync-accounts.sh < accounts.txt

There are a number of possible results:

Here is a more complete perl example:

#!/usr/bin/perl -w

use LWP::UserAgent;
use strict;

my $myemail  = 'user@no-ip.com';
my $mypass   = 'ExamplePassword';
#my $url = 'http://www.no-ip.com/members/mail/remoteaccts-rpc.php';
my $url = 'https://www.no-ip.com/members/mail/remoteaccts-rpc.php';

die "Usage: $0 domain < accounts.txt" if @ARGV != 1;
my $domain = $ARGV[0];

sub urlencode { 
    my $s = shift; 
    $s =~ s/([^A-Za-z0-9\-_.!~*])/sprintf("%%%02X", ord($1))/seg; 
    return $s; 
}

my @accounts = ;
chomp @accounts;
my $accounts_string = join ',', @accounts;

my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => $url);
   $req->content_type('application/x-www-form-urlencoded');

$req->content(
    sprintf('email=%s&password=%s&domain=%s&action=REPLACEALL&accounts=%s',
        urlencode($myemail),
        urlencode($mypass),
        urlencode($domain),
        urlencode($accounts_string)
    )
);


my $res = $ua->request($req);

if($res->is_success) { print $res->content; }
else { print $res->status_line, "\n"; }

 

Related Articles