Email forwarding to PHP

Paulbreeuwsma

New member
Joined
Oct 23, 2004
Messages
3
Is it possible with directadmin to forward email to a php file? I tried to make a .forward file in my ftp root, but the server ignores it. I'm not the admin of the server, so some files i can't change.
 
I'm not sure what you're trying to do.

Do you mean you've got a php program and you want the email contents piped into that file?

Exim allows piping of mail into a program, as long as the program is ready to accept email on standard input.

The syntax for piping email through the control panel should be exactly the same as for piping it in an aliases file, though I'm not sure whether or not the DA panel allows all the pipe characters to be implemented, so if not you'll have to get your provider to do it for you.

There are lots of resources all over the 'net you can use to learn how to create aliases to pipes.

There may even be some examples on your server, though you can't read them without shell access.

They'd be visible by doing a "locate list.aliases" command and then looking at the resulting files.

Jeff
 
I want to make a php program that filters email. If an email is forwarded to the php program it can read the headers and the body.
I can program php, so I only must know how to send the email to the file.
I've read this, but I don't know which mail system the provider is using. I tried something but it didn't work.
How can I check if I'm using exim or sendmail?
Do you know which file in which dir I must change and what I must change?
What is the difference between forwarding, alais and piping?
 
Paulbreeuwsma said:
I can program php, so I only must know how to send the email to the file.
I've read this, but I don't know which mail system the provider is using.
From the above sentence I'm presuming you're a site owner without any shell, admin or root access to the server.

If that's the case, then consider this:

DA servers run exim. They don't run sendmail so you can't be using sendmail on a DA powered website. Yes, you can send mail to sendmail in your scripts, but it's just a symbolic link to exim.

You can set up an alias through the forwarder system; there's no real difference between aliasing and forwarding. I don't know if the DA interface allows all possible piping characters to be entered, but you can check; if it doesn't, you'll get an error when you try to save the forward.

There is an address pipe in the exim.conf (I wrote it); here's the contents:
Code:
# This transport is used for handling pipe deliveries generated by alias
# or .forward files. If the pipe generates any standard output, it is returned
# to the sender of the message as a delivery error. Set return_fail_output
# instead of return_output if you want this to happen only when the pipe fails
# to complete normally. You can set different transports for aliases and
# forwards if you want to - see the references to address_pipe in the directors
# section below.

address_pipe:
  driver = pipe
  return_output
I don't know if you'll need to add "pipe_as_creator" or not because I don't know the purpose of it.

If you do, then the systems administrator will have to do it for you; and it will effect the entire server, so they may not be willing.

Ask your hosting company.

If you're the admin, then you can do it yourself using a shell connection.

Jeff
 
Back
Top