Redirect an email to a PGM

Hi,

I need to redirect all mails from an email adress to a CGI program (email piping)

I know how to do that with sendmail, but not with Qmail/vpopmail

For example, for mail support, in sendmail I’d edit the /etc/aliases and I’d add this line

support@domaine.com |’/dir/to/my/pgm.CGI’

How to do the same things in QMAIL/Vpopmail ?

Thanks
Pascal

So here is what I’ve done.

If somebody could confirm me it should work

I’ve created a file in ~alias/ :
.qmail-carat-hosting:com-support

Then add this line in it
|/home/carathos/carat-hosting.com/html/cgi/email.cgi

I’m just worried about the chmod (u=rw g=r) and chown (root:qmail) on this file :


[root@padawan alias]# ls -a
.  ..  .qmail-carat-hosting:com-support  .qmail-mailer-daemon  .qmail-postmaster  .qmail-root
[root@padawan alias]# ls -al
total 16
drwxr-sr-x    2 alias    qmail        4096 Oct  9 15:40 .
drwxr-xr-x   10 root     qmail        4096 Oct  3 16:56 ..
-rw-r--r--    1 root     qmail          65 Oct  9 15:40 .qmail-carat-hosting:com-support
lrwxr-xr-x    1 alias    nofiles        17 Oct  3 16:56 .qmail-mailer-daemon -> .qmail-postmaster
-rw-r--r--    1 alias    nofiles        25 Oct  8 19:23 .qmail-postmaster
lrwxr-xr-x    1 alias    nofiles        17 Oct  3 16:56 .qmail-root -> .qmail-postmaster
[root@padawan alias]#
[root@padawan alias]# cat .qmail-carat-hosting\:com-support
|/home/carathos/carat-hosting.com/html/cgi/email.cgi

Thanks

Pascal

it doesn’t seems to work :\

Ok in fact I’ve made a big mistake.

The file to create is in VpopMail

So I created, for the user support, a file named .qmail-support in /home/vpopmail/domains/mydomain.com/

and then add my line in it
|/home/carathos/carat-hosting.com/html/cgi/email.cgi

the CHOwn the file to vpopmail and chmod my cgi script to 755

And now everything is working fine !!!

Pascal

Had I responded in time pascal that’s what I would have told you do to :). And for the general audience just make a .qmail-<username> file in the /home/(user)/var(domain)/mail directory with the piped command you want to happen when email hits that users account, and it’ll work.

Chris

so what if you wanted admin@domain.com, sales@domain.com, etc… all directed to support- How would i do that?

Just in general mpower? I’d create aliases for each (admin@ and sales@) and point them to support@. If you wanted them all to inject into a script like Pascal is doing here then I’d still make 2 aliases (for admin@ and sales@) and make the .qmail-support file have the pipe to the program.

Chris

Hi Chris,

I figured it out after messing with interworx a week a go. It’s funny, after you replied to this thread- an email was sent to me about it. But on other threads- it didn’t send me any notifications at all! o pooh! Thankx