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?
ndoeberlein
Posted: Jun 30 2004, 03:47 AM
Quote Post


Wizard
*********

Group: Members
Posts: 419
Member No.: 997
Joined: 22-March 04



Will the script work on Windows without any changes?

I realize the post-data will need to be modified.

Thanks!
PM
Top
MayVortex
Posted: Jun 30 2004, 06:25 AM
Quote Post


Script Guru
*****

Group: Members
Posts: 194
Member No.: 354
Joined: 13-November 02



QUOTE

Will the script work on Windows without any changes?


Yes.

QUOTE

I realize the post-data will need to be modified.


Is it a question? smile.gif
PMEmail Poster
Top
ndoeberlein
Posted: Jun 30 2004, 03:31 PM
Quote Post


Wizard
*********

Group: Members
Posts: 419
Member No.: 997
Joined: 22-March 04



QUOTE (MayVortex @ Jun 30 2004, 12:25 AM)
Is it a question? smile.gif

No. Just letting you know that even though I'm Linux impaired, I figured out that part. biggrin.gif
PM
Top
zyere
Posted: Nov 15 2004, 11:31 PM
Quote Post


Newbie
*

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



help i can't seem to get this filter to work. i've added all the entries to filters.post-data.tab and i've coppied the perl script to the filters directory and made the adjustments for my domain. but i can't seem to get it to work.
any idea's sugestions ?????
newbie.gif


--------------------
user posted image
PMEmail Poster
Top
ndoeberlein
Posted: Nov 15 2004, 11:53 PM
Quote Post


Wizard
*********

Group: Members
Posts: 419
Member No.: 997
Joined: 22-March 04



Which platform are you running on?

Please post your filter.post-data.tab and your actual filter file used to call the script.

Thanks!
PM
Top
zyere
Posted: Nov 16 2004, 12:12 AM
Quote Post


Newbie
*

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



fedora core 2 xmail 1.20

here is my filter.post-data.tab
CODE

"/var/MailRoot/filters/filter-post.pl"[tab]"@@FILE"[tab]"@@USERAUTH"[newline]


here is my filter-post.pl

CODE

#!/usr/bin/perl

if ($ARGV[1] !~ /\@tech-it.net/){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 "test footer \r\n";
               }
           print TX $_."\r\n";
}
close(TX);
close(T);


--------------------
user posted image
PMEmail Poster
Top
ndoeberlein
Posted: Nov 16 2004, 09:08 PM
Quote Post


Wizard
*********

Group: Members
Posts: 419
Member No.: 997
Joined: 22-March 04



Have you tried running XMail in debug mode to see if the filter is firing?
PM
Top
zyere
Posted: Nov 17 2004, 01:02 AM
Quote Post


Newbie
*

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



if i run xmail in debug it show's the filter firing but gives me an error a filter error -97


--------------------
user posted image
PMEmail Poster
Top
zyere
Posted: Nov 18 2004, 01:14 AM
Quote Post


Newbie
*

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



here is the exact error i get

execv error: cmd='"/var/MailRoot/filters/filter-post.pl"
SMTP filter error (-97) : Filter = ""'/var/MailRoot/filters/filter-post.pl""

any ideas ?

***** UPDATE *****

the execv error is because there's a error reading the perl script (it gives me some freaky compilation error)
____error____

Use of un-intializited value in patern match (m//) at /var/MailRoot/filters/filter-post.pl line 3

can someone give me an example of how to fire this script manually so i can atempt to debug it ?

i'm not sure how to pass the ARGV values from a shell prompt


--------------------
user posted image
PMEmail Poster
Top
zyere
Posted: Nov 20 2004, 12:12 AM
Quote Post


Newbie
*

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



ok since i couldn't get may's script working i'm atempting to re-create it. but i know nothing about perl if someone out there know's perl please tell me what is wrong with this:
CODE

#!/usr/bin/perl

$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);
}


When i test it from shell it seems to work ok


--------------------
user posted image
PMEmail Poster
Top
ndoeberlein
Posted: Nov 20 2004, 12:30 AM
Quote Post


Wizard
*********

Group: Members
Posts: 419
Member No.: 997
Joined: 22-March 04



Sorry, I'm not a script person or a linux person.

The only thing I can suggest with your original script is first taking a text file and piping it through the filter from the command line to see if it appends the disclaimer.

If that works, then the next step is the firing process from XMail. What other filters are running? Try disabling all filters except the one you are trying to debug.

Do you have the latest version of perl installed? Have you set up appropriate rights to the necessary directories?

Give those a try and let us know.

Thanks!
PM
Top
zyere
Posted: Nov 23 2004, 01:06 AM
Quote Post


Newbie
*

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



i have the latest perl version running the filter stil gives a

execv error: cmd='"/var/MailRoot/filters/filter-post.pl"
SMTP filter error (-97) : Filter = ""'/var/MailRoot/filters/filter-post.pl""

error when fired , the only othere filters i have running is the AV filter and with it disabled i get the same result

when i run the script from shell and pipe a txt file through it that works fine


--------------------
user posted image
PMEmail Poster
Top
zyere
Posted: Nov 23 2004, 11:29 PM
Quote Post


Newbie
*

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



*** here's something interesting *****
when i read the debug locally the error it throws is
execv error: cmd='"/var/MailRoot/filters/filter-post.pl"
SMTP filter error (-97) : Filter = ""'/var/MailRoot/filters/filter-post.pl""

from an SSH client it looks like this
execv error: cmd='"/var/MailRoot/filters/filter-post.pl"'
SMTP filter error (-97): Filter = ""/var/MailRoot/filters/filter-post.pl""



--------------------
user posted image
PMEmail Poster
Top
atomant
Posted: Nov 24 2004, 02:07 PM
Quote Post


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

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



Check permissions on perl file (chmod 755)


--------------------
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, 12:12 AM
Quote Post


Newbie
*

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



permissions on the perl file are 755

same error occurs


--------------------
user posted image
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