Solved

parse email with php (LDA dovcot, procmail)

Posted on 2013-01-12
3
311 Views
Last Modified: 2013-01-13
Using the mailparse to extract the data or use the read in nd process the input buffer one line at a time.  A better and simpler approach depending on your mail server and whether it is passing the incoming mail through an LDA dovcot, procmail. The from and the body can be extracted and presented to your php with the from and subject as arguments to your script and the body of the message as input on stdin.



I am looking to parse email with php

how would I do this
0
Comment
Question by:rgb192
3 Comments
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 300 total points
ID: 38772021
You might want to start with an understanding of the email RFC documents.  The references and external links with this article are mandatory reading.
http://en.wikipedia.org/wiki/Email_address

After that, it's just plain and simple PHP string manipulation.  You can use explode(), strpos(), substr() and related PHP string functions to manipulate the strings, extract data, etc.
0
 
LVL 77

Assisted Solution

by:arnold
arnold earned 200 total points
ID: 38772198
Limiting your inquiry to PHP eliminates many experts with mail processing abilities and insights. Add the mail server in use as a category.
0
 

Author Closing Comment

by:rgb192
ID: 38772551
thank you

the first answer was about email
and the second answer was about asking questions on experts-exchange


I have a related question based on the second answer

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27993920.html
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php simple error message 4 24
showing loader for php/mysql/ajax live search 13 26
PHP Installer 5 25
PHP curl issue VERBOSE output 18 46
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

803 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