Solved

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

Posted on 2009-05-15
5
747 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
[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
  • 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 20 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

615 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