Darren:
Anyone up on qmail/perl? I need to migrate a system from sendmail to qmail but could do with some help
What exactly is the perl for? If it's to change the mbox files into maildir ones, then there are already scripts to do that. I think the qmail web site has some. (Do you really want a non-free mailserver?)
Darren:
Anyone up on qmail/perl? I need to migrate a system from
sendmail to qmail
but could do with some help
What exactly is the perl for? If it's to change the mbox files into maildir ones, then there are already scripts to do that. I think the qmail web site has some. (Do you really want a non-free mailserver?)
Sorry for the delay in getting back. This is a bit of a long one sorry
We currently have sendmail configured to parse local mail through a perl script. This takes 3 arguments From, User, Host
user being the alias, host being the domain.
It then checks a couple of files for the domain, and works out what local user should have the mail.
If then goes to that users home directory and looks for a file called .redirect
This either redirects it to another local user or to a program for processing or another email address
It accepts multiple lines for multiple aliass
This works great with sendmail. But..... I want to migrate over to qmail
I have a vanilla install of qmail without any problems and use it on our backup MX servers.
The perl script delivers mail using a program called spooler this takes the arguments spooler [-o owner] -u user
and the perl script delivers it using the following perl
open(MAIL, "$local -o $destiny -u $destiny"); } $header_done = "NO"; foreach $line (@msg) { if ( (uc($line) =~ /^DATE: /) && ($header_done eq "NO") ) { $header_done = "YES"; print MAIL $line; print MAIL "X-Mailer-Version: $version\n"; print MAIL "X-From: $from\n"; print MAIL "X-Recipient: $user@$host\n"; } elsif (uc($line) =~ /^X-FROM: /) { # suppress duplicate line } elsif (uc($line) =~ /^X-RECIPIENT: /) { # suppress duplicate line } elsif (uc($line) =~ /^X-MAILER-VERSION: /) { # suppress duplicate line } else { print MAIL $line; } } close(MAIL); } &log;
--
The mail should also be delivered to /var/spool/mail, some users don't own their own home dir.
The perl script works like a dream with sendmail but I really would like to drop sendmail for qmail is possible.
Any help from anyone would be much appreciated
Thanks
Darren
on Thu, Feb 07, 2002 at 10:03:25PM -0000, D wrote:
We currently have sendmail configured to parse local mail through a perl script. This takes 3 arguments From, User, Host
user being the alias, host being the domain.
It then checks a couple of files for the domain, and works out what local user should have the mail.
If then goes to that users home directory and looks for a file called .redirect
This either redirects it to another local user or to a program for processing or another email address
This can be done with .qmail files (or .forward if you get the dot-forward addon.)
You can invoke "spooler" by letting all mail fall back onto the qmail "alias" user. It's home is usually something like /var/qmail/alias. In /var/qmail/alias, if you create a file called .qmail there with something like: | preline perl /path/to/myscript.pl
all mail should be piped into the script.
Why do you want to keep with this perl script? I think it's quite probably possible to replace it with mechanisms native to qmail, which would be much faster and more efficient.
The mail should also be delivered to /var/spool/mail, some users don't own their own home dir.
qmail natively too.
on Thu, Feb 07, 2002 at 10:03:25PM -0000, D wrote:
We currently have sendmail configured to parse local mail through a perl script. This takes 3 arguments From, User, Host
user being the alias, host being the domain.
It then checks a couple of files for the domain, and works out what local user should have the mail.
If then goes to that users home directory and looks for a file called .redirect
This either redirects it to another local user or to a program for processing or another email address
This can be done with .qmail files (or .forward if you get the dot-forward addon.)
You can invoke "spooler" by letting all mail fall back onto the qmail "alias" user. It's home is usually something like /var/qmail/alias. In /var/qmail/alias, if you create a file called .qmail there with something like: | preline perl /path/to/myscript.pl
all mail should be piped into the script.
That didn't seem to work correctly I already tried this.
Why do you want to keep with this perl script? I think it's quite probably possible to replace it with mechanisms native to qmail, which would be much faster and more efficient.
We have 12 servers that need upgrading, each user has their own .redirect file or .block file (The perl script also reads this for blocking mail for spam)
I just want to keep the script and drop it onto a qmail install
I don't think it will be too hard it just needs a couple of tweaks. I thought it was the /var/qmail/rc file and the .qmail-default files that needed editing but just not sure what way to go
Darren
Why do you want to keep with this perl script? I think it's quite probably possible to replace it with mechanisms native to qmail, which would be much faster and more efficient.
We have 12 servers that need upgrading, each user has their own .redirect file or .block file (The perl script also reads this for blocking mail for spam)
I just want to keep the script and drop it onto a qmail install
I don't think it will be too hard it just needs a couple of tweaks. I thought it was the /var/qmail/rc file and the .qmail-default files that needed editing but just not sure what way to go
The rc file now has :-
#!/bin/sh
# Using syslod for logging # Using /usr/local/sbin/mailer to deliver local messages by default
$exec env - PATH="/var/qmail/bin:$PATH" \ qmail-start '|preline /usr/local/sbin/mailer $SENDER $USER $HOST' splogger qmail
and the .redirect file is read and will forward mail but when it comes to local delivery i loose it somewhere.
The perl script reads a config:- testserver.uk myhome
and anything @testserver.co.uk goes to the user myhome. I know its working as it reads the .redirect file and does do remote redirecting.
Its the local delivery thats failing (Its calling spooler and running from there)
I tried piping to /bin/mail but still no good
Im missing something just cant work out what
Darren
I fixed it.
/var/qmail/rc :- #!/bin/sh
# Using syslod for logging # Using /usr/local/sbin/mailer to deliver local messages by default
$exec env - PATH="/var/qmail/bin:$PATH" \ qmail-start '|preline /usr/local/sbin/mailer $SENDER $USER $HOST' splogger qmail
/var/qmail/alias/.qmail-default :- |preline /usr/local/sbin/mailer $SENDER $USER $HOST
References in mailer to /usr/sbin/sendmail -fMAILER-DAEMON@$host";
Were replaced with qmail-inject and it uses the local spooler command to put the mail into /var/spool/mail and not the users home dir.
It also works with users that do not own their own home dir. This means the current POP account setup works
Thanks again to everyone
Darren