Solved

parse email with php (LDA dovcot, procmail)

Posted on 2013-01-13
3
609 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

Resolve DNS query failed errors for Exchange
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.
In this video we show how to create an email address policy 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…
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…

813 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

14 Experts available now in Live!

Get 1:1 Help Now