have: (zimbra + ad) + (openfire + ad + miranda +ntlm)
need: send a message to Jabber when i receive a new e-mail message.

in /opt/zimbra/postfix/conf/master.cf.in

change :
smtp inet n - n - - smtpd
smtp inet n - n - - smtpd
-o content_filter=filter:dummy

and add
filter unix - n n - 20 pipe
flags=Rq user=zimbra argv=/opt/zimbra/conf/script/filter.pl ${sender} ${recipient} ${user}

in /opt/zimbra/conf create dir script
and create file filter.pl

require "/opt/zimbra/conf/script/unit_ldap.pl";

$SENDMAIL='/opt/zimbra/postfix- -G -i';

$numArgs = $#ARGV;
my $jid,$jabber;
open(file,"> $INSPECT_DIR/in.$$");

while (<stdin>) {
print (file "$_");

close (file);

for ($i=1;$i<=$numArgs/2;$i++)
system "$SENDMAIL $to <$INSPECT_DIR/in.$$";

if (index($to,"abcmebel.ru")>0)
if ($jabber eq "yes")
system "/opt/zimbra/conf/script/sendmessage.php $jid \"You have new message from $from \n---mail server\"";
# system "logger \"script running from from= $from to=$to user=$user count =$numArgs jid=$jid, jabber=$jabber i=$i\"";


unlink "$INSPECT_DIR/in.$$" ;

and file unit_ldap.pl

package unit_ldap;
use Net::LDAP;
my $prefix="\@domain";

#change it
$ldap = Net::LDAP->new("ldap-server");
$ldap->bind("username\@domain", password=>"passwd");


sub get_jid_from_mail{
my $mail=$_[0];
my $sAMAccountName,$info,$jabber;
# print "mail= $mail";
$mesg = $ldap->search(filter=>
"(&(objectclass=user)(!(userAccountControl:1.2.840 .113556.1.4.803:=2))(mail=$mail))",
attrs=> ['sAMAccountName','info']);

@entries = $mesg->entries;
foreach $entry (@entries) {
# print " \n$sAMAccountName\n";
@lines=split /----/,$info;
# ($par,$val)=split /:/,$a;
foreach $arg (@lines)
($par,$val)=split /:/,$arg;
if ($par eq "jabber")

if ($jabber ne "no")
if (length($sAMAccountName)<1)
return "$sAMAccountName\@tcdon.ru",$jabber;



and add you script for sending message
for example xmpphp - Project Hosting on Google Code