0

I'm pretty close here, all the examples I have found have been helpful. I can run the PHP from the terminal but cannot get the script to run from a received email.

The part I am missing is getting the incoming email to connect to the qmail alias

for context. the email I am using is

bb3k@thatdomain.com

in the root of the server I created an alias in

/var/qmail/alias

the alias is named

.qmail-bb3k

in the .qmail-bb3k file i have

|/var/www/vhosts/thatdomain.com/cgi-bin/scrapeAttachment.php

running that file directly gives me

./.qmail-bb3k: line 1: syntax error near unexpected token `|'

sending an email to bb3k@thatdomain.com does nothing, the email makes it through, but the PHP script is never run.

everytime the script is modified, qmail is restarted (not sure if that is necessary.)

i can get the PHP script to run by modifying the .qmail-bb3k script to

php /var/www/vhosts/thatdomain.com/cgi-bin/scrapeAttachment.php

which works when run from the terminal, which we already knew, but quadruple checking doesn't hurt

the links that I've been referencing

http://www.evolt.org/incoming_mail_and_php

http://www.geeksdrafts.net/blog/2011/02/11/sample-qmail-files/

There is enough moving parts that i'm not sure if there is a simple syntax issue or something outside the scope of the bash and php.

any suggestions would be greatly appreciated

t.o.

DetDev
  • 309
  • 3
  • 9
  • 1. anything in the mails logs. 2. does the php file start with "#!/usr/bin/php" 3. does setting it up to forward to another mbox instead of piping to a program work? –  Oct 18 '11 at 20:19
  • the email logs look good, no errors. the php file does start with `#!/usr/bin/php` doing a `&bob@thatdomain.com` does nothing :) so I should probably hunt that down. – DetDev Oct 18 '11 at 20:58
  • sounds like qmail not php, but i use exim for this so not sure where to start. :( –  Oct 19 '11 at 01:29
  • you are correct! it is qmail, thanks for the help. I am opting to use the qmail file in the email users directory instead `/var/qmail/alias` it's doing what I want it to, it's just not the way i wanted to do it :) – DetDev Oct 19 '11 at 15:39

3 Answers3

1

DetDev, this is a bit of a late reply but did you realize that the .qmail file you created in this folder will be erased every time MediaTemple runs a Plesk update?

/var/qmail/mailnames/thatdomain.com/user

I discovered this problem when I noticed that my email piping setup broke about once a month and saw that the .qmail file was empty.

Unfortunately I have not found an solution to this other than re-creating the file manually. It's quite a hassle when I'm not available to fix the server and messages are lost.

  • i didn't know that, fortunately it was a short lived piece that did not suffer this. what it is interesting is that i'll be doing something that may suffer from plesk updates shortly, i'll probably opt out of the automatic updates. thanks for the tip! – DetDev May 30 '13 at 14:48
0

i got around plesk updates overwriting the .qmail file using chmod -i .qmail so the file can't be changed. didn't cause any issues when updating automatically.

Barry
  • 116
  • 3
0

So this is not an answer to the specific question above it is an alternative solution to what this question was trying to accomplish.

FYI, This is on Plesk with MT as the hosting provider. Different servers, different settings YMMV...

Short version. Instead of using an alias under

/var/qmail/alias

and creating the .qmail-user there I just went to the specific user under

/var/qmail/mailnames/thatdomain.com/user

in that folder is a .qmail file. when I modified that, the outcome is a success.

Thanks to @Dagon for getting me top step back and debug at a higher level!

Cheers,

t.o.

DetDev
  • 309
  • 3
  • 9