Help - Search - Members - Calendar
Full Version: Ensim Email Piping
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
spage
Setting up email piping with Ensim seems to cause fits. It took me a little to get it down but after researching and trial and error I have had luck using these methods. Here is a small how-to compiled from my notes.

Paths
Open the script and make sure that the paths are correct. /usr/bin/perl -w (add the -w switch) or for php /usr/bin/php . Keep or move perl scripts into the cgi-bin directory. If your script has a path to sendmail in it make sure that it is correct /usr/sbin/sendmail

Perl Scripts
This has been posted here before and people still seem to have problems. The only things that I can think of that I did differently are to add the -w switch to the #!/usr/bin/perl -w line of the script and move the script to the cgi-bin directory. Make sure that you chmod your script to 755

SSH in as root:
# cd /home/virtual/yourdomain.com/etc/smrsh
# ln -s ./../../var/www/helpdesk/cgi-bin/automail.pl (change to your path and script)

verify that the link is owned by root
# ls -l

# cd ..
# pico aliases
Scroll to the last line of the file and add the line:

support: "|/etc/smrsh/automail.pl"

Ctrl-X and save, then the command:
# newaliases

PHP Scripts
I have not tried this on a site running in the"High Security" mode so at this point I am not sure if this works in anything other than 3.1 compatibility mode. Make sure to chmod your script to 755

ssh in as server admin and su- to root

# cd /home/virtual/site#/fst/etc/smrsh

make sure php is usable by sendmail
# ln -s /usr/bin/php php

Create a link to your php script
# ln -s /var/www/pathtoscript/script.php (change to your path and script)

verify that the link is owned by root
# ls -l

# cd ..
# pico -w aliases

add this to the aliases file for each email address that you want to pipe

support: "|/etc/smrsh/yourscript.php"
sales: "|/etc/smrsh/yourscript.php"

save and exit

# newaliases

I hope that this helps and if anyone sees anything that I missed, please add it here.

Scott

Several people have noted that if the above fails they have been successful using this:

yourAlias: "|/etc/smrsh/php /var/www/pathto/pop3pipe.php"
REBIS
Additional tips:
Be sure you don't already have the aliases you want to pipe created in Ensim.
Works in Ensim high security mode also.
important
I get a bounced back email :

smrsh: pipe.php not available for sendmail programs (stat failed)
554 5.0.0 Service unavailable

Everything is alright and I have been trying the same thing for past 1 month.

Looks like its just me, btw I have to create that particular user from ensim CP too ?

For example sales, will i have to create that from ensim cp too ?

Regards
spage
No, you shouldn't create a user in Ensim that is the same as the pipe email. What program are you trying to pipe to?

Scott
important
I am using a custom script, I just have it so that it creates a file and puts a record into database.

Works perfectly if i run it by :

/usr/bin/php /path/to/script/pipe.php
Or just with php /path/to/script/pipe.php
boing
Big 'ol bump!
icon_smile.gif

Ensim Version: 10.3.3
Site Security: High
Scripting Language: php

The command 'newaliases' didn't appear to be doing anything. As I would add/remove an alias, the same alias count would be outputed. This was further proven by tweaking my pipe line with a new script name, testing it w/ failed output returned referencing the old failed script name rather than the new script name. But -- I figured out that if you created your alias "by hand", and then edited/added/deleted another Ensim alias, your "by hand" alias would be updated and work.

(I.e. create an alias 'by hand' called 'myalias', then go into Ensim and create a random alias called 'myalias2'. Each time you need to tweak 'myalias', you need to edit another alias such as 'myalias2' for the change to go into effect. When you are all peachy-keen, you can delete 'myalias2'.)

So, final solution for this case:

1. Add alias by hand as described above, then add another random alias in Ensim named something different.
2. I did not have to symlink php, my alias looks like this:
CODE
neptune:  "|neptune_test2.php"

3. You can locate the script inside /home/virtual/site##/fst/etc/smrsh or symlink it. If you symlink it, you need to symlink it to ../../var/www/path-to-script.php --- you are jailed afterall in this high security sight!
4. Don't forget to make the first line in your .php file (adjust path as necessary): (an interpreter I believe it is called? Maybe not...)
CODE
#!/usr/bin/php

(Otherwise it'll just return an error containing each line of your .php file, not actually execute the .php file.)

Hope this helps someone else who Googles this thread years later like I did!
icon_wink.gif

-boing?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.