By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,046 Members | 2,058 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,046 IT Pros & Developers. It's quick & easy.

How e-mail receive works with php ?

P: n/a
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

Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 25 Mar 2005 10:31:09 -0800, "siliconmike" <si*********@yahoo.com> wrote:
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..


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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
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

Jul 17 '05 #3

P: n/a
On 26 Mar 2005 03:56:50 -0800, "siliconmike" <si*********@yahoo.com> wrote:

[ Please quote some context when replying ]
I checked. Procmail has no port for windows:

http://laku19.adsl.netsonic.fi/era/p...ni-faq.html#nt
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.
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
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.
but how ? what tools ?


Cygwin.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #4

P: n/a
siliconmike wrote:
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 ?

<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/

Jul 17 '05 #5

P: n/a
<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 ?

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.