thanks for the suggestion..
for others with the same problem, i ended up doing the following instead..
basically, the address in question was for an automated request system, which although it had a replyto: address in the e-mail, it would never be replied to by a human (slightly different than the inital question regarding using public folders and auto replies) and actually i ended up not even delivering messages to any public folder at all... [although it might be possible to combine this approach with a public folder e-mail address and have delivery in addition to the autoreply??? suggestions..?]
so.. my approach is not connected to scalix per se, but related to sendmail..
i used a perl script, placed in /etc/smrsh/ to accomplish the auto reply (NOTE: you might have to put the script in this directory for this to work unless you override security mechanisms in sm)
here is the code:
Code: Select all
#!/usr/bin/perl
sub trim($);
$default_domain = "domain.com";
$Sflag = 0;
$Fflag= 0;
$domain = "";
#open (FILE, ">>/etc/autoreply/autoreply.log");
while (<STDIN>) {
if ((/^From /x) && ($Fflag == 0)) {
($from, $address, $date) = split (/ /, $_, 3);
$address =~ tr/[A-Z]/[a-z]/;
$Fflag = 1;
} elsif ((/^To: /x) && ($Sflag == 0)) {
@subj = split (/ /, $_,);
$Sflag = 1;
}
# print FILE $_;
}
#close (FILE);
if ($address =~ /mailer-daemon/) {
exit(0);
} elsif ($address =~ /postmaster/) {
exit(0);
}
if($Sflag == 1) {
foreach $sb (@subj) {
if(($sb =~ m/\w*\.\w/)) {
($usr,$dom) = split( /@/,$sb);
$dom =~ s/[\]\[{}>'"<!()]//gs;
$domain = $dom;
}
}
}
if($domain eq "") {
$domain = $default_domain; #Default
}
else {
$domain = trim($domain);
}
$domain =~ tr/[A-Z]/[a-z]/;
$Domain = ucfirst($domain);
open SENDMAIL, "| /usr/sbin/sendmail -bm -oi -f no-reply\@$domain $address";
print SENDMAIL <<EOM;
From: "$Domain" <no-reply\@$domain>
To: $address
Subject: Auto Response to $Domain Inquiry
EOM
if($domain eq $default_domain) {
open (FILE, "/etc/autoreply/autoreply.default");
} else {
open (FILE, "/etc/autoreply/autoreply.alternate");
}
while (<FILE>) {
print SENDMAIL;
}
close (FILE);
close SENDMAIL;
exit(0);
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}