Solved

pear errors from mail parser

Posted on 2013-01-15
11
474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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 i…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

630 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