Solved

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

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange Mailbox 2 38
MX Backup 4 40
Exchange 2013 Update Issue CU7 to CU13 5 40
uploading image to a profile page 1 8
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now