Wednesday, July 4, 2007

cPanel Mail Forwarder


This handly little program forwardes all emails coming to a certain specified email address and forwards to a forwarding list.

Setting up the email capturing

e-Mail can be captured using a PERL script. The contents of the email must be pipped in. The capturing an passing of the email can be done through cPanel.

Click Mail

Click Forwarders

Add Forwarder

In the text box to the right side, you can provide an email address or a path to your PERL program that can process your email and extract relevant information.

In order to send the contents of the email to a PERL program we have to PIPE it to the program. PIPING is just redirection of standard output of the mail receiving program to your custom PERL script.

"|perl /home/domain/scripts/"

use strict;

my $Email = join '',<STDIN>;

$Email // has your email contents