Web Hosting Talk







View Full Version : pipe mail


Omair Haroon
09-01-2001, 06:13 AM
Hello,

Can anyone help me pipe a user mail to a file..


Actually, I am setting Ticket Smith and don't know how to pipe or procmail whatever a user mail like support@domain.com to go to gateway.pl of Ticket Smith..


Please help.. :(

mikeknoxv
09-01-2001, 07:54 AM
Originally posted by Omair Haroon
Hello,

Can anyone help me pipe a user mail to a file..


Actually, I am setting Ticket Smith and don't know how to pipe or procmail whatever a user mail like support@domain.com to go to gateway.pl of Ticket Smith..


Please help.. :(

I apolgize for yesterday.

Assuming you are using sendmail...

* Put gateway.pl in a non-web-accessible directory and CHMOD it 777
* Edit /etc/aliases (pico /etc/aliases)
* Make sure you do not already have an entry for "support" (if you do, remove it)
* Add the following line into /etc/aliases: support: "|/path/to/gateway.pl" (be sure to replace "/path/to/" with the location to gateway.pl)
* Save /etc/aliases
* Find "newaliases" on your system and execute it

You should be up and running from this point.

Omair Haroon
09-01-2001, 10:22 AM
Hey...

I have a question..


How would the /etc/aliases know which domain name I am talking about ??


Becuase

support: "|/path/to/gateway.pl"

Does'nt have anything in it which shows which domain we are referring it to...

Thanks in advance..

cperciva
09-01-2001, 10:41 AM
Originally posted by mikeknoxv

* Put gateway.pl in a non-web-accessible directory and CHMOD it 777


*sob*

PLEASE don't do that. Posting your root password on IRC would be less suicidal than doing that. You really don't want to have everyone able to edit programs which are going to be executed by root.

A better solution than the above is to create a .forward file in the home directory of the user to whom the email is directed; a simple `echo "|/path/to/script" >> ~/.forward` will do the job.

Omair Haroon
09-01-2001, 03:40 PM
Cperciva,


Thanks for the advice.. But I don't know how do you, where do you and why do you create a .forward file..

Can you please be more detail ?? Or infact give a step by step guide?? It would be very helpful for all of us..


Thanks,
Omair

cgisupp
09-01-2001, 08:58 PM
First up the RAQ runs smrsh so piping email to the script from a .forward file will result in errors. The errors will look like:
sh: perl not available for sendmail programs 554

Here is what you need to do.

create a symlink from /usr/adm/sm.bin
to the script in question.
cd /usr/adm/sm.bin
ln -s /path/to/gateway.pl

Place the .forward file in the home directory for that user.
ie.
/home/sites/<site_number>/users/myuserdir/.forward.

chmod the users dir to chmod 2711
ie.
chmod 2711 /home/sites/<site_number>/users/username
the chmod 600 the .forward file

The forward file needs to look like:

\username, "|/usr/adm/sm.bin/gateway.pl"

This does actually work on a RAQ2 and RAQ3

HTH

mikeknoxv
09-01-2001, 09:31 PM
Originally posted by cperciva


*sob*

PLEASE don't do that. Posting your root password on IRC would be less suicidal than doing that. You really don't want to have everyone able to edit programs which are going to be executed by root.

A better solution than the above is to create a .forward file in the home directory of the user to whom the email is directed; a simple `echo "|/path/to/script" >> ~/.forward` will do the job.

<edit> Nevermind my last post... 777 was incorrect. 755 should do</edit>

Omair Haroon
09-02-2001, 04:31 AM
Nevermind my last post... 777 was incorrect. 755 should do


That even worked either :(


cgisupp :

Here is what I did..

create a symlink from /usr/adm/sm.bin
to the script in question.
cd /usr/adm/sm.bin
ln -s /path/to/gateway.pl

Then I created a .forward file with the below line in it replacing the username :

\ticket, "|/usr/adm/sm.bin/gateway.pl"

Then I uploaded it to

/home/sites/home/users/ticket/.forward

Then I chmod it to 600

chmod 600 /home/sites/home/users/ticket/.forward

and then I chmodded the user directory to 2711

chmod 2711 /home/sites/home/users/ticket

But after doing all of this when I sent an e-mail to ticket@domain.com it did not worked..

Is there anything that is left ?? Or is there anything that I am doing wrong ??


Please correct me :(


' Omair

Omair Haroon
09-03-2001, 08:06 AM
Anyone ?? :rolleyes: :rolleyes:

swissmonk
09-03-2001, 10:22 AM
Try this:

1. Create a normal user on your account
2. Change the user directory to 2711
3. Create a file named .procmailrc in the user directory

:0c
* (^To:|^CC:|^Cc:) .support@domain.com
| /home/sites/sitexx/web/script.pl

4. chmod .procmailrc to 600

And try again

Omair Haroon
09-03-2001, 12:22 PM
Swissmonk,

Thanks I did it.. But that did'nt worked either.. :( :( :(

I remember having catch-all-email account on this domain..

Would having catch-all-email causing some problems ???


Please help guys... :bawling: :bawling: :bawling: :bawling: :bawling: