Solved

pear errors from mail parser

Posted on 2013-01-15
11
457 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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 is …
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

15 Experts available now in Live!

Get 1:1 Help Now