How e-mail receive works with php ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • siliconmike

    How e-mail receive works with php ?

    How to set up my PC (or what tools do I need) so that when any email
    comes to the server, a php script is automatically run to parse the
    email ?

    I've never done this before. Later I would like to transfer my website
    to a Linux box, but I'm using a PC currently to develop the site.

    Details are welcome. In fact I have no concepts about which program or
    "server" is supposed to receive email, then how would that program
    "pass" the email as a parameter to a php script ? Is a pop server
    involved in this process ? If yes, the what is the most popular one
    (which is available for both pc and linux) ? And so on..

    Thank you.
    Mike

  • Andy Hassall

    #2
    Re: How e-mail receive works with php ?

    On 25 Mar 2005 10:31:09 -0800, "siliconmik e" <siliconmike@ya hoo.com> wrote:
    [color=blue]
    >How to set up my PC (or what tools do I need) so that when any email
    >comes to the server, a php script is automatically run to parse the
    >email ?
    >
    >I've never done this before. Later I would like to transfer my website
    >to a Linux box, but I'm using a PC currently to develop the site.
    >
    >Details are welcome. In fact I have no concepts about which program or
    >"server" is supposed to receive email, then how would that program
    >"pass" the email as a parameter to a php script ? Is a pop server
    >involved in this process ? If yes, the what is the most popular one
    >(which is available for both pc and linux) ? And so on..[/color]

    Look up "procmail".

    Normally there will be an SMTP mail server running on wherever your email
    account is. This will receive emails, and write them to your mailbox. procmail
    can be used to run programs in response to emails arriving.

    POP3 comes into the picture when you want to get at your mailbox from a remote
    machine.

    If you're developing on your PC, then it's unlikely that PC is going to be
    where emails arrive, i.e. it won't be running the receiving end of an SMTP
    server. You could use "fetchmail" to regularly fetch email locally, "procmail"
    to run them through PHP, and run a local POP3 server if you then also want to
    read the same emails with a POP client.

    Also look up Cygwin - this is a particularly useful bit of software, as it
    gives you a Unix-like environment on Windows. You'll then be able to work with
    the same tools that'd be available later when you move it to Linux.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • siliconmike

      #3
      Re: How e-mail receive works with php ?

      I checked. Procmail has no port for windows:



      Maybe I can do something like this:
      - run an smtp server on my win xp box
      - send email to someone@localho st
      - receive email on localhost
      - auto-run a php script upon receiving the email

      but how ? what tools ?

      Thanks
      Mike

      Comment

      • Andy Hassall

        #4
        Re: How e-mail receive works with php ?

        On 26 Mar 2005 03:56:50 -0800, "siliconmik e" <siliconmike@ya hoo.com> wrote:

        [ Please quote some context when replying ]
        [color=blue]
        >I checked. Procmail has no port for windows:
        >
        >http://laku19.adsl.netsonic.fi/era/p...ni-faq.html#nt[/color]

        That's why I recommended Cygwin; you get a complete Unix toolset on Windows,
        including the gcc compiler, and it provides enough compatibility that many Unix
        applications will compile from source without modification if Cygwin doesn't
        include a pre-built version.
        [color=blue]
        >Maybe I can do something like this:
        >- run an smtp server on my win xp box
        >- send email to someone@localho st
        >- receive email on localhost
        >- auto-run a php script upon receiving the email[/color]

        Yes, that's pretty much what I said, except I would probably avoid running the
        SMTP server on the XP box. Use an account elsewhere, and use "fetchmail" to
        retrieve the email, "procmail" to run it through PHP and optionally bounce it
        on to another account that you can read with POP3, unless the emails are
        entirely for PHP and you don't need to read them yourself, in which case skip
        the bouncing step.
        [color=blue]
        >but how ? what tools ?[/color]

        Cygwin.

        --
        Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
        <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

        Comment

        • R. Rajesh Jeba Anbiah

          #5
          Re: How e-mail receive works with php ?

          siliconmike wrote:[color=blue]
          > How to set up my PC (or what tools do I need) so that when any email
          > comes to the server, a php script is automatically run to parse the
          > email ?[/color]
          <snip>

          Look at this thread
          <http://groups.google.c om/groups?threadm= cnn3c.529026$na .1267192@attbi_ s04>

          --
          <?php echo 'Just another PHP saint'; ?>
          Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

          Comment

          • siliconmike

            #6
            Re: How e-mail receive works with php ?

            <snip>

            Look at this thread

            In your thread is shown method to pipe email to a php script.

            What part of the email is piped ? I presume a full header + email body
            would be piped .. right?

            I need to extract the From: and To: fields from the email header. Where
            can I find official email header format ?

            Comment

            Working...