XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum -> Adding a Disclaimer to outgoing mail?

Reply to this topicStart new topicStart Poll

> Adding a Disclaimer to outgoing mail?, How?
atomant
Posted: Nov 30 2004, 03:55 PM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 1776
Member No.: 427
Joined: 18-January 03



Check for the shebang line in the script. Try to use #!/usr/bin/perl -w


--------------------
Bye,
Sasa



-------------------------------------------------------------------

All electric machines work on smoke...when the smoke escape from machines, they don't work anymore
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming or what?"
PMEmail PosterUsers WebsiteICQ
Top
zyere
Posted: Nov 30 2004, 06:43 PM
Quote Post


Newbie
*

Group: Members
Posts: 13
Member No.: 1392
Joined: 5-November 04



ok once again here is my configuration:
filters.post-data.tab
CODE

"perl /var/MailRoot/filters/testfooter.pl"      "@@FILE"        "@@USERAUTH"



testfooter.pl
CODE

#!/usr/bin/perl -w

$file = $ARGV[0];
$domain = $ARGV[1];

$footer= "***example disclaimer**** \r\n";

if($domain !~ /\@mydomain.com/){exit (0);}
else {
open (ApendFile,">>$file") || die ("Could not open file. $!");
print ApendFile ($footer);
close (ApendFile);
exit (7);
}




--------------------
user posted image
PMEmail Poster
Top
BooT
Posted: Jan 5 2005, 06:53 PM
Quote Post


Guru
**********

Group: Members
Posts: 747
Member No.: 375
Joined: 29-November 02



Has anyone ever got this filter to work yet?
On WIN32?

I got this so far.... :

SMTP filter run: Filter = "c:\perl\bin\perl.exe c:\mailroot\filters\disclaimer.p
l" Retcode = 0

My Disclaimer.pl looks like this:

CODE
#!/usr/bin/perl

if($ARGV[1] !~ /\@my_Domain.com/){exit (0);}

open(T,$ARGV[0]);
$cnt=0;
open(TX,">".$ARGV[0]);
while(<T>){
  $_ =~ s/\r//g;
  $_ =~ s/\n//g;
  if(($_ =~ /boundary/)and(!$cnt)){
      $cnt++;
      @tb = split('\=',$_);
      $tb = $tb[1];
      $tb =~ s/\"//g;
  }
  if(($tb)and($_ =~ /\-\-$tb/)and($cnt==1)){
      $cnt++;
      print "Place your text here\r\n";
  }
  print TX $_."\r\n";
}
close(TX);
close(T);


And my filters.post-data.tab looks like this:
CODE
"c:\perl\bin\perl.exe c:\mailroot\filters\disclaimer.pl" "@@FILE" "@@USERAUTH"


And it does not seem to work.....
Any Ideas?





--------------------
________________________________________________________________________________

--= Running XMail Server 1.22 on Windows 2003 Virtual Server Since 16 August 2006 =--
[--- Ran Xmail on 2000 Server till Aug 2006 ---]
[--- 1.21 From 21 June 2005 till 15 Jan 2006---]
[--- 1.20 From 20 July 2004 till 21 June 2005---]
[--- 1.17 From 20 October 2003 till 20 July 2004---]
PMEmail Poster
Top
guillaume.devoyon
Posted: Feb 10 2005, 05:01 PM
Quote Post


Newbie
*

Group: Members
Posts: 24
Member No.: 394
Joined: 16-December 02



i Have same problem on other script ..
Did you resolved it ?

Guil


--------------------
Bye
Guillaume
PMEmail PosterUsers Website
Top
Digdug
Posted: Feb 11 2005, 09:33 AM
Quote Post


Member
***

Group: Members
Posts: 92
Member No.: 1456
Joined: 10-January 05



Why don't you change the exit code, so you can see if it's working correctly (change it to 100 or so...)
PMEmail Poster
Top
Marcus Gunther
Posted: Oct 5 2006, 10:49 AM
Quote Post


Newbie
*

Group: Members
Posts: 4
Member No.: 2278
Joined: 3-October 06



The following setup works for me on Windows 2000 with XMail 1.22:

XMail is installed in o:\vol2\xmail

o:\vol2\xmail\filters.out.tab looks like this:
CODE
"*" "*" "0.0.0.0/0" "0.0.0.0/0" "footer.tab"


o:\vol2\xmail\filters\footer.tab looks like this:
CODE
"o:\perl\bin\perl.exe o:\vol2\xmail\filters\footer.pl" @@FILE


o:\vol2\xmail\filters\footer.pl looks like this:
CODE
$file = substr($ARGV[0],4);

$footer= "[-->> Disclaimer <<--]\r\n...Your Text here...\r\n";

open (ApendFile,">>$file") || die ("Could not open file. $!");
print ApendFile ($footer);
close (ApendFile);
exit (7);


Two additional points:
1. I did not use filters.post-data.tab, because that would add the signature to all mails (including local). I wanted to add it only to external mails.
2. In footer.pl, I'm removing the first 4 characters from the @@FILE argument that was passed from footer.tab. I don't know if there is a reason for it or if it's a bug, but the @@FILE argument was passed like this:
\\?\O:\Vol2\XMail\spool\17\9\mess\...
After removing the first 4 characters ("\\?\") with the substr function, the file path is working OK.

Regards,
Marcus
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Scripting Corner | Next Newest »

Reply to this topicStart new topicStart Poll