Solved

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

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

Office 365 Advanced Training for Admins

Special Offer:  Buy 1 course, get 2nd free!  Buy the 'Managing Office 365 Identities & Requirements' course w/ Accelerated TestPrep, and automatically receive the 'Enabling Office 365 Services' course FREE!

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
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…

738 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