Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I forward incoming e-mails to a PHP processing script from Microsoft Exchange?

Posted on 2009-05-15
5
Medium Priority
?
765 Views
Last Modified: 2013-12-13
I would like to build an e-mail processor for Microsoft Exchange whereby any incoming e-mail sent to xxxxx@domain.com is forwarded to a PHP script which will parse the e-mail, log the e-mail in a database, and forward the e-mail on to another recipient. I've done some reading on the topic and understand this may be accomplished using VBScript with an OnDeliverMessage function that "pipes" the e-mail to a PHP script. However, our exchange server has other e-mail domains that have incoming messages which *should not* be intercepted by the PHP script.

So my question:

How do I achieve the forwarding of incoming mail messages to a PHP script using exchange (for a single domain only). The recipient address can be anything@domain.com.

Any help is greatly appreciated!!
0
Comment
Question by:devvy
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:cwalter9
ID: 24398243
Would it be out of the question to setup a sendmail server to handle this? This is a trivial configuration with sendmail. You can simply say send a copy of all mail for @company.com to archive@company.com and you will have a copy of every message.
0
 

Author Comment

by:devvy
ID: 24398269
That is possible only if I were to build a PHP script that runs as a cron job and pulls the e-mails from the archive@company.com account for parsing. The main reason they need to be added to a database is because the e-mail conversations need to be logged for viewing in a web application.
0
 
LVL 3

Expert Comment

by:cwalter9
ID: 24399997
There many possible solutions you would have available to you. If the end goal is just to be able to view all the emails via a web browser then you could have sendmail copy each mail message into a mailbox that you access via webmail. This would also allow more than one access method to the mail archive, IMAP added in to Outlook or any other IMAP client, view them via a web browser through webmail.

You could also use procmail to process the message in many different ways. Let me know if you are just looking to have the messages available to view via a web browser or if more is needed.
0
 

Accepted Solution

by:
devvy earned 0 total points
ID: 24400050
The end goal is to integrate all of the e-mail communication into an existing web application. What I may have to do is add a catch-all policy to forward all emails sent to @domain.com to a specific mailbox, which I will connect to using PHP and imap_open to pull the e-mails instead of having them pushed.
0
 
LVL 3

Assisted Solution

by:cwalter9
cwalter9 earned 80 total points
ID: 24400089
I setup something close to this but I had all email delivered into a file. I had a buddy write a perl script to parse out the message body to be decrypted by gpgp and then emailed off. But, the meaning I was getting to is you can have sendmail output a copy of each message to a mailbox. The mailbox would just be a file which you could read in with PHP (Sounds like your comfortable there) and then clear the file each time your done. You could store the data anywhere that PHP could put it.

Let me know if that sounds close to your app needs. I will post the sendmail config stuff and also the file format to help you out.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

963 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