Solved

parse email with php (LDA dovcot, procmail)

Posted on 2013-01-13
3
613 Views
Last Modified: 2013-01-15
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 and learn about mailservers

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

Assisted Solution

by:arnold
arnold earned 250 total points
ID: 38772623
There are several options for mailservers on the Linux platform.  Commonly sendmail is installed by default. Postfix, exim, qmail, courier mta are some.
Postfix is somewhat simpler to configure. The install is simple with most distro.

Your question is overly broad.
0
 
LVL 3

Accepted Solution

by:
mikey1h earned 250 total points
ID: 38773672
I Think I understand that you want to  RECEIVE email atyourmailserver.  Ifso, set upan eMailaddress in sendmailthat fowards to php (my php is/usr/sbin/php) and then instal lthe attached mail class and use this code.  It will give you the sender, subject and message contents into variables in your code.

chdir(dirname(__FILE__));
require_once 'class.email.php';

// Parse incoming email from STDIN
$email = email::parseSTDIN();

//Who sent the message
$sender=($email->getSenderEmail() );
//TheMessage itself
$message = trim($email->getTextContent());
//Who the Message was sent to
$to =  ($email->getRecipientEmail());
//The Subject of the eMail
$subject = ($email->getSubject());

Open in new window




Once the email is received into the code via STDIN, you will have the following Variables...
$sender
$to
$subject
$message
mail.zip
0
 

Author Closing Comment

by:rgb192
ID: 38781312
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Installer 5 37
MySQL Sub-Select Query Returning Duplicate Result 7 45
Wordpress Security 29 48
MSSQL - Lock Row from reading by other programs 9 35
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
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 viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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