Help-Site Computer Manuals
  Algorithms & Data Structures   Programming Languages   Revision Control
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac




$Revision: 1.0 $

Mail::Audit::Centipaid - Mail::Audit plugin to check for email postage


use Mail::Audit qw(Centipaid); my $mail = Mail::Audit->new;

# Configure the filter

%conf = ( 'acct' => ``AEF001'', # account_name merchant id 'amount' => 0.005, # amount to charge per email 'https' => ``'',# payment url 'pass' => ``adonis'', # receipt_password 'lang' => ``en'', # language setting 'authserver' => ``'', # centipaid_receipt_server 'authport' => '2021', # port of receipt server 'email' => '', # email 'debug' => 0 # 1=show output, 0=supress output );

        # check mail for epostage

        ($code,$reason)= $mail->check_mail(%conf);

        $reply_msg = qq{Your message here..};

        # reject email without postage

        if ( $code == 1 ) {


                             subject=>"Email postage missing: could not deliver",




        # accept the ones that do have one

        if ( $code == 0 ) {$mail->accept; }


Mail::Audit::Centipaid is an email filter that is used to detect the precence of electronic postage. Once detected, the postage is checked against the receipt server of to insure that the the proper payment has been made. can process electronic postage as low as $0.001. The idea of this filter came about as another method to control the growing problem of SPAM, which was proposed by the Adaptive Mail Delivery Protocol (AMDP). Please refer to for more info.

Mail::Audit::Centipaid can be used by individuals or companies to designate one or more email accounts SPAM free. This is done by installing a .forward for these accounts, and use the enclosed program to filter out mail that does not contain valid postage. Only paid email will be allowed through the filter.

Centipaid supports two types of stamps.

1. CENTIPIX stamps, which are bought by the sender and used to make payments. Payment processing is deducted from the payment done by the sender.

2. EZPASS stamps, which are issued by the receiver and given to individuals he/she wants to grant them postage-free access the email account. Payment processing is paid by the recepient.

The module can also be used in conjunction with SpamAssassin to autoamtically

reject email messages with a certain spam ranking, and to be directed to pay 

for postage.

Other uses include the designation of postage-requiered email accounts such as the ones used for consulting, support, business to business, etc..

Postage paying Paying for postage is easy, once the sender has obtained a CENTPIX from The sender can re-use the same CENTIPIX in payments for postage, online access, shopping online, etc.. until its funds are completely used up.

Including postage in emails The postage can be included in the BODY or HEADER of the email message.

Mail::Audit::Centipaid generate a valid payment url for postage payment. When used, centipaid will give the payee the option to include the postage receipt in the body of the email by copying and pasting the text into the body of the email message, or using the online email interface, which includes the postage receipt in the header of the message. Both are supported by this module.

How does it work? Email messages are parsed for AMDP-PAYMENT-RCPT string which specifies that the message contains an AMDP style electronic postage. Once it is detected the receipt number is extracted, and centipaid receipt server is contacted to get a verification that a payment has been made for the postage rate set in the configuration.

Ideally the AMDP-PAYMENT-RCPT should reside in the header, however since AMDP protocol is new, and email applications do not support its inclusion in the header area of a message, the BODY of the message is searched for the string. Please refer to for information about the protocol.

If the receipt is found, and it is a valid one, check_mail() returns an Ok code, but if the rcpt is not found, it returns an error code, and a well formed url that is used to send to the sender to ask them to pay for the postage.

Please refer to for the most updated version of this module, since other methods of payment may be available.


Checks the mail header and body for the presence of electronic postage (AMDP-PAYMENT-RCPT).

Returns an array containing two elements. The first array element contains one of the following codes 0 = success, 1 = no/bad receipt, 2 = problem contacting Centipaid receipt server. The second array element is primarily used with error code 1, which contains the properly formated payment url.

if the error code is 0, then the message should be accepted, other wise it should be rejected, or dropped.


acct account_name

 The account number is issued by 

 for a given domain name.  This number is unique 

 and it determines who gets paid.


=item B<pass> receipt_password

 The password is used only in socket authetication.  

 It does not grant the owner any special access 

 except to be able to query the receipt server for 

 a given receipt number.
amount 0.5

 The amount is a real number (float, non-integer) 

 that specifies how much the user must pay to be 

 granted access to the site.  For example amount 

 0.5 will ask the user to pay 50 cents to access the

 site.  The value of amount is in dollar currency.


=item B<lang> en

 This defines the language of the payment page 

 displayed to the user. It is set by the site admin 

 using the two letter ISO 639 code for the language. 

 For example requieres the payment info to

 be displayed in arabic on centipaid, will 

 need several sections of its site to show payment 

 requests in different languages. Some of the ISO

 639 language codes are: English (en), Arabic (ar), 

 japanese (ja), Spanish (es), etc..

 This defines the email to be used when emailling

 back with the proper postage. default to the 


 This should contain the payment url assigned to the

 account number. This defaults to
authserver centipaid_receipt_server

 This should contain the receipt server assigned to 

 the account number above


=item B<authport> 2021

 This should contain the port number of receipt 

 server assigned to the account number above


Centipaid: Micropayment solution used in collecting and clearing epostage
CentiPIX: Centipaid Portable payment media which is used to make payments instead of using a credit card. This gives allows the payment of postage as low as $0.001


  Proposed protocol used to control the wide spread of SPAM.  One

  of its features is the adoption of postage as a method of controlling



Thanks to Simon Cozens for the Mail::Audit module, which allowed me to develope a consitent and easy to use Centipaid mail plugin.


Adonis El Fakih, <>


the Mail::Audit manpage