Connecting Tech Pros Worldwide Help | Site Map

How e-mail receive works with php ?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:17 PM
siliconmike
Guest
 
Posts: n/a
Default 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


  #2  
Old July 17th, 2005, 12:17 PM
Andy Hassall
Guest
 
Posts: n/a
Default Re: How e-mail receive works with php ?

On 25 Mar 2005 10:31:09 -0800, "siliconmike" <siliconmike@yahoo.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.andyhsoftware.co.uk/space> Space: disk usage analysis tool
  #3  
Old July 17th, 2005, 12:18 PM
siliconmike
Guest
 
Posts: n/a
Default Re: How e-mail receive works with php ?

I checked. Procmail has no port for windows:

http://laku19.adsl.netsonic.fi/era/p...ni-faq.html#nt

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

but how ? what tools ?

Thanks
Mike

  #4  
Old July 17th, 2005, 12:18 PM
Andy Hassall
Guest
 
Posts: n/a
Default Re: How e-mail receive works with php ?

On 26 Mar 2005 03:56:50 -0800, "siliconmike" <siliconmike@yahoo.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@localhost
>- 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.andyhsoftware.co.uk/space> Space: disk usage analysis tool
  #5  
Old July 17th, 2005, 12:18 PM
R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
Default 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.com/groups?threadm=cnn3c.529026$na.1267192@attbi_s04>

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

  #6  
Old July 17th, 2005, 12:18 PM
siliconmike
Guest
 
Posts: n/a
Default 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 ?

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.