Solved

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

Posted on 2009-05-15
5
735 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This video discusses moving either the default database or any database to a new volume.

713 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