$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' => "http://pay.centipaid.com/",# payment url 'pass' => "adonis", # receipt_password 'lang' => "en", # language setting 'authserver' => "pay001.centipaid.com", # centipaid_receipt_server 'authport' => '2021', # port of receipt server 'email' => 'you@domain.com', # 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 ) { $mail->reply(from=>$mail->from, subject=>"Email postage missing: could not deliver", body=>$reply_msg); $mail->ignore; } # 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 Centipaid.com to insure that the the proper payment has been made.
Centipaid.com 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 amdpmail.com 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 centifilter.pl 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 www.centipix.com. 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 amdpmail.com 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 centipaid.com for the most updated version of this module, since other methods of payment may be available.
check_mail(%conf)
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.
The account number is issued by ceentipaid.com for a given domain name. This number is unique and it determines who gets paid.
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.
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.
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 ayna.com requieres the payment info to be displayed in arabic on centipaid, CNN.com 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 $mail->to
This should contain the payment url assigned to the account number. This defaults to http://pay.centipaid.com
This should contain the receipt server assigned to the account number above
This should contain the port number of receipt server assigned to the account number above
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, <aelfakih@cpan.org>
Mail::Audit
3 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
'=item' outside of any '=over'
To install Mail::Audit::Centipaid, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Audit::Centipaid
CPAN shell
perl -MCPAN -e shell install Mail::Audit::Centipaid
For more information on module installation, please visit the detailed CPAN module installation guide.