Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP Script to Receive Email

Posted on 2008-06-18
5
Medium Priority
?
1,846 Views
Last Modified: 2013-12-13
Hi,

System Requirement: Windows Server 2003

I need a php script running on this web server to receive emails. Ideally, there would be an email system installed on the web server.

Method 1 (preferred): When an email is received by the email system, a php script is invoked which processes that email.

Method 2: A php script is periodically invoked that checks for email from an email server (local or remote).  

One way or another, I need to receive email with php.

Any tips?

Thanks for your time
0
Comment
Question by:oxygen_728
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 1200 total points
ID: 21816081
There are several mail server which run on mysql. You might be able to use a Sceduled Task to run a php script to either use php pop/imap functions, or tap directly into mysql.

For php mail check functions you can of course also use a non-mysql mailserver and use pop or imap.
0
 

Author Comment

by:oxygen_728
ID: 21816119
Roonan, thanks for the tips.

Do you know a good mail server for a windows server that can invoke a script or executable when an email is received?

Thanks for your time
0
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 1200 total points
ID: 21816156
I'm not an expert on the mailserver world, so can't realy suggest one. I like the setup of the Sceduled Task or Cronjob, as it is mailserver independant which allows my application to shift to another (mail)server more easily, and allow my php server to run from another machine than my mailserver.
0
 

Author Comment

by:oxygen_728
ID: 21816175
Roonan, I understand - my main concern is that I have a larger process of which this is just a small part. So if I have a scheduled task that operates once per minute, then that will slow down the entire system. And I'd be nervous about scheduling the task too fast... with windows being the way it is

0
 

Accepted Solution

by:
kevinx24 earned 800 total points
ID: 21994577
oxygen,

You may be able to do this using a hosted service, Email2HTTP (http://www.email2http.com).

This will allow you to handle mail by simply writing a script that handles a form POST.   Parts of the email would be delivered to your PHP script as form post variables, like $_POST["subject"], $_POST["body"], etc.

See code sample taken from Email2HTTP website:


<?php
 
// Save each attachment from the message to disk
foreach ($_FILES as $attachment)
{
	move_uploaded_file($attachment["tmpname"],
		"../files/" . $attachment["name"]);
}
 
// Send a reply back to the sender by email
// by simply producing some output
$numberOfFiles = sizeof($_FILES);
echo "Thank you, my friend.  I have received your "
	. $numberOfFiles . " files."
	. "\r\n\r\n---Original message---\r\n"
	. $_POST["body"];
 
?>

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question