Solved

pear errors from mail parser

Posted on 2013-01-15
11
460 Views
Last Modified: 2013-02-04
this question is related to the code sample I received in
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_27993920.html

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



mail.zip


Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\mail\Mail\mimeDecode.php on line 65


require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;C:\Program Files (x86)\NuSphere\PhpED\php5\..\include_lib') in C:\wamp\www\mail\Mail\mimeDecode.php on line 65
0
Comment
Question by:rgb192
  • 6
  • 4
11 Comments
 
LVL 6

Expert Comment

by:Kailash Aghera
ID: 38781355
You will have to put pear package file in your PHP "include_path" directory. You are receiving this error because PEAR.php is not available in your directory as well as in your PHP include path.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 38781365
I think it must be path problem. You need to configure the right path there. check out, http://pear.php.net/manual/en/installation.getting.php
0
 

Author Comment

by:rgb192
ID: 38785432
do I change the location in one of the included files (see original question attachment)
0
 
LVL 6

Accepted Solution

by:
Kailash Aghera earned 500 total points
ID: 38785794
Hi,

You will need to follow the below steps:

[1] Install pear package in your system if it is not installed
[2] Edit your php.ini file and add your pear package installation path in include_path like as follow:

include_path='.;C:\Program Files (x86)\NuSphere\PhpED\php5\..\include_lib;c:\pear'

Replace c:\pear with the location of your pear package.

[3] To find your php.ini upload phpinfo() page and check the location for "Loaded Configuration" file path. You will need to edit this php.ini.

[4] After making the changes, restart your web server.

Kailash
0
 

Author Comment

by:rgb192
ID: 38785819
do i have to change any of the attached mail files to include address of pear
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Expert Comment

by:Kailash Aghera
ID: 38787615
Once you set pear package path in your php configuration, you do not need to modify any files or source. It should include pear module automatically when it is required..

Kailash
0
 

Author Comment

by:rgb192
ID: 38799854
I can not get pear to run on localhost wamp

but I uploaded file and folder to hostgator (which has pear)

 file ran with no errors and echo line number at the end (line 16)

<?php
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());
echo __LINE__;

Open in new window


do I need to have this file be the pipe which is setup in cpannel.

if so, do I need a she bang at the top of script
0
 
LVL 6

Expert Comment

by:Kailash Aghera
ID: 38808523
do you want to execute this script via cron or do you want to use this script for other purpose?
0
 

Author Comment

by:rgb192
ID: 38813341
when email is received using email piping

or

reading input .eml file (easier for testing)
How should I change stdin to input .eml file
0
 

Author Comment

by:rgb192
ID: 38843326
could I replace line 5

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


with a copy paste email .eml file

$email='this is the eml file'
0
 

Author Closing Comment

by:rgb192
ID: 38852689
you told me to run on a server with pear which is a step in the correct direction

thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
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…

920 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

17 Experts available now in Live!

Get 1:1 Help Now