email piping error

26 posts / 0 new
Last post
#1 Wed, 05/20/2009 - 20:28
anwoke8204

email piping error

Hi, I am trying to pipe an email alias to a file, but after setting it up and clicking save on the alies I get the following error:

Failed to lock file /etc/postfix/virtual after 5 minutes

the file I am trying to pipe is /home/atiptopcomputer/public_html/ticket/sources/pipe.php

any ideas as to why it can't like the file?

Wed, 05/20/2009 - 20:47
Joe
Joe's picture

What exactly are you entering into the form when creating the alias?

--

Check out the forum guidelines!

Wed, 05/20/2009 - 22:02 (Reply to #2)
anwoke8204

the file is no longer failing to lock though, but when I send a test email to the email address that is supposed to be piping to the program, the program is not picking it up. I have checked the settings within the program and they look right

here is the doc on the program and setting up the email piping, the doc is for cpanel but I used the steps <a href='http://docs.accord5.com/Email_Piping' target='_blank'>http://docs.accord5.com/Email_Piping</a>

I used this virtualmin forum to find out how to set up the email piping <a href='http://www.virtualmin.com/forums/virtualmin/%5Bsolved%5D-forward-mail-to... target='_blank'>http://www.virtualmin.com/forums/virtualmin/%5Bsolved%5D-forward-mail-to...

Wed, 05/20/2009 - 22:08 (Reply to #3)
anwoke8204

I have it set to forward to teh program and to another email address on the server, but it is not being recieved by the email address

Wed, 05/20/2009 - 22:50 (Reply to #4)
anwoke8204

the .forward sounds like a good idea, how would I write one of those?

Wed, 05/20/2009 - 23:12 (Reply to #5)
Joe
Joe's picture

Just this:

|/path/to/pipe.php

--

Check out the forum guidelines!

Fri, 05/29/2009 - 19:03 (Reply to #6)
anwoke8204

ok, so I just create a new file named .forward or does it need to be named like email.forward

once the file is created I just put in:

|/path/to/pipe.php (with the |)

sorry, I have never had to make a file like that before, so a bit confused. and then once done I assume it would have either 751 or 755 permissions right?

Fri, 05/29/2009 - 19:38 (Reply to #7)
andreychek

It'd just be &quot;.forward&quot;. Also, try using &quot;750&quot; for the permissions (if that doesn't work, try using 755, just in case it's not being executed as your user).

The .forward file needs to be in the home directory of that email user.

If things don't work, look in both the mail log, as well as the procmail log (both in /var/log), for any clues as to what's going wrong.
-Eric

Fri, 05/29/2009 - 21:11 (Reply to #8)
anwoke8204

ok, I have it in /home/atiptopcomputer/scripts and I have tried 750 and 755 and it is still comming up as permission denied, here is what is in the error log for mail

May 30 00:05:20 srv1 postfix/smtpd[19083]: connect from mail-px0-f119.google.com[209.85.216.119]
May 30 00:05:20 srv1 postfix/smtpd[19083]: BD1C831E63A: client=mail-px0-f119.google.com[209.85.216.119]
May 30 00:05:20 srv1 postfix/cleanup[19086]: BD1C831E63A: message-id=&lt;004d01c9e0ec$76ebfa50$64c3eef0$@com&gt;
May 30 00:05:20 srv1 postfix/qmgr[5241]: BD1C831E63A: from=&lt;**********@gmail.com&gt;, size=4130, nrcpt=1 (queue active)
May 30 00:05:20 srv1 local[19088]: fatal: execvp /home/atiptopcomputer/scripts/.forward: Permission denied
May 30 00:05:20 srv1 postfix/local[19087]: BD1C831E63A: to=&lt;support-hardware-atiptopcomputer.com@srv1.rooksystems.com&gt;, orig_to=&lt;support-hardware@atiptopcomputer.com&gt;, relay=local, delay=0.32, delays=0.3/0.01/0/0.02, dsn=4.3.0, status=deferred (temporary failure. Command output: local: fatal: execvp /home/atiptopcomputer/scripts/.forward: Permission denied )
May 30 00:05:51 srv1 postfix/smtpd[19083]: disconnect from mail-px0-f119.google.com[209.85.216.119]

there is nothing in procmail about it

Sun, 05/31/2009 - 12:36 (Reply to #9)
andreychek

Well, I'm not entirely certain what the problem is, but what are the permissions on the directories leading up to your .forward file?

For example:

ls -ld /home/atiptopcomputer

ls -ld /home/atiptopcomputer/scripts

Thu, 06/11/2009 - 11:34 (Reply to #10)
anwoke8204

Hi, sorry this took so long, here are the results of the above:

drwxr-x--- 13 atiptopcomputer atiptopcomputer 4096 2009-05-29 01:20 /home/atipto pcomputer

drwxr-xr-x 2 atiptopcomputer atiptopcomputer 4096 2009-05-29 23:58 /home/atiptop computer/scripts

any idea as to what else we can do to get it working?

Many thanks

Sat, 06/13/2009 - 14:16 (Reply to #11)
andreychek

If your script isn't being run as the user "atiptopcomputer" (which it sounds like it may not be), then every directory up to and including the "scripts" directory needs to be, at a minimum, world executable.

The "scripts" directory is, but /home/atiptopcomputer is not. You can fix that dir by typing:

chmod +x /home/atiptopcomputer

Sat, 06/13/2009 - 18:45 (Reply to #12)
anwoke8204

I made the atiptopcomputer directory executable by using chmod +x and then sent the test email again, and recieved the following error"

[doce] Reporting-MTA: dns; srv1.rooksystems.com X-Postfix-Queue-ID: F3E8631E6BD X-Postfix-Sender: rfc822; anwoke8204@gmail.com Arrival-Date: Sat, 13 Jun 2009 17:38:55 -0600 (MDT)

Final-Recipient: rfc822; support-hardware-atiptopcomputer.com@srv1.rooksystems.com Original-Recipient: rfc822;support-hardware@atiptopcomputer.com Action: failed Status: 5.3.0 Diagnostic-Code: x-unix; /home/atiptopcomputer/scripts/.forward: 1: Syntax error: "|" unexpected [/code]

the above was attached to the error email the server sent to my mail client Any idea as to why it isn't working and why my mail server is still showing up as srv1.rooksystems.com when it should be atiptopcomputer.com?

it also had the following in the email?

support-hardware-atiptopcomputer.com@srv1.rooksystems.com (expanded from support-hardware@atiptopcomputer.com): Command died with status 2: "/home/atiptopcomputer/scripts/.forward". Command output: /home/atiptopcomputer/scripts/.forward: 1: Syntax error: "|" unexpected

Many thanks

Sat, 06/13/2009 - 18:51 (Reply to #13)
andreychek

Alright, so that's good news -- the script is running now.

The problem is that there's a syntax error in the script.

Which leads me to the next issue -- I've long since lost track of what you're trying to do and why you're trying to do it :-)

Can you explain the details of your setup here, and how exactly this .forward file is being called? -Eric

Sun, 06/14/2009 - 01:21 (Reply to #14)
anwoke8204

I am using a help desk program that if someone sends an email to a certain email address it will automatically create a ticket for it, or if me or someone responds to the ticket then it sends the customer an email and they can reply to teh email and thier comments will be attached to the ticket. I tried getting it to go with pop3 but it wouldn't work, so the company (Accord 5 Trellis Desk) said to use email piping and have a script pipe the email to the pipe.php, and then it will work the way it should. the pipe.php script file is in a directory that the mail server can't access, so Joe suggested I create this .forward file, as someone created the .forward file in the past and was able to get it working. it was suggested I put the file in /home/atiptopcomputer/scripts. let me know if this helps

Many thanks

Sun, 06/14/2009 - 08:20 (Reply to #15)
andreychek

Okay, cool.

How are you going about invoking it?

That is, where is your script being called from, and what syntax is being used to do that? -Eric

Mon, 06/15/2009 - 01:12 (Reply to #16)
anwoke8204

I am using a mail alias to invoke it, when an email comes in to hardware-support@atiptopcomputer.com, the alias is set to pipe to the script which then forwards to the pipe.php file for the software and then it also gets forwarded to a regular email so it can be checked later as well

Mon, 06/15/2009 - 11:26 (Reply to #17)
andreychek

Alright -- it's been ages since I've attempted to use a .forward file, but my understanding is that they're called directly by Postfix (or Sendmail).

That is, by sticking a .forward file in $HOME, assuming Postfix is configured to handle them, it should be executed automatically.

So you wouldn't need to call it via a pipe or anything.

There's some additional info here in the section "SYSTEM-WIDE AND USER-LEVEL ALIASING":

http://www.postfix.org/local.8.html

Wed, 05/20/2009 - 21:02
anwoke8204

in the alias name I am entering support-hardware then it fills in @atiptopcomputer.com, then I click the drop down box and choose feed to program, and then I put in the location below.

it is also set ot forward to a local mail box as well, should I remove the mail box?

Wed, 05/20/2009 - 21:10
anwoke8204

seems as if it might be postfix as a whole, I try to add a new email address and the system just hangs, but I can do anything else just fine. I have stopped postfix and restarted it and still the same issues

Wed, 05/20/2009 - 21:52 (Reply to #20)
Joe
Joe's picture

Try restarting Webmin.

--

Check out the forum guidelines!

Wed, 05/20/2009 - 21:53
anwoke8204

I rebooted the entire server and all seems to be working now, however I still can't seem to get the piping working

Wed, 05/20/2009 - 22:01 (Reply to #22)
Joe
Joe's picture

Define &quot;can't seem to get the piping working&quot;? Is there an error? When/where are you having a problem?

--

Check out the forum guidelines!

Wed, 05/20/2009 - 22:09
anwoke8204

its giving me this error when it tries to forward the email to the program

temporary failure. Command output: local: fatal: execvp /home/atiptopcomputer/public_html/ticket/sources/pipe.php: Permission denied

Wed, 05/20/2009 - 22:12 (Reply to #24)
anwoke8204

I have tried changing permissions on the file, I have set them from 755 to 775, to 777 and still get permission denied, it says I have to make the file executable so 755 should do the trick to make the file executable. every test I have sent now comes back with the above output and it just stays queued in the mail queue till I flush the queue.

Wed, 05/20/2009 - 22:36 (Reply to #25)
Joe
Joe's picture

Remember that the mail server is running as &quot;nobody&quot;. It probably doesn't have access to that directory.

You have a few options to make it accessible. You could make the whole path up to that file +x for everybody (751 for /home/atiptopcomputer/...).

You could put the file somewhere where user 'nobody' has access to it. /home/scripts or /etc/scripts or something along those lines. You could even make a directory for every user with 751 permissions explicitly for this purpose, if you wanted to keep 750 permissions on /home.

You could create a mailbox, rather than an alias, and use the .forward file to send the mail instead (just as in the first mention in that linked thread). I think that would make it run as the user, since it'd be the delivery agent (procmail) doing the work.

--

Check out the forum guidelines!

Topic locked