Page 1 of 1

Pear's Mail Function

Posted: Fri Nov 17, 2006 9:20 am
by oldtimer
I have been looking and looking for the solution to my problem.

I use Pear's mail to send emails. It works great connecting to smtp server. However it will not work Command Line method/cron

I get

Code: Select all

<b>Warning</b>:  main(Mail.php): failed to open stream: No such file or directory in <b>/path/file.php</b> on line <b>2</b><br />
<br />
<b>Warning</b>:  main(): Failed opening 'Mail.php' for inclusion (include_path='.:/usr/local/lib/php') in <b>/path/file.php</b> on line <b>2</b><br />
I then linked directlyto the Mail.php
include("/usr/share/pear/Mail.php");
Instead of
include("Mail.php");

I get past the point above and now get

Code: Select all

<br />
<b>Warning</b>:  send(Net/SMTP.php): failed to open stream: No such file or directory in <b>/usr/share/pear/Mail/smtp.php</b> on line <b>148</b><br />
<br />
<b>Warning</b>:  send(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/local/lib/php') in <b>/usr/share/pear/Mail/smtp.php</b> on line <b>148</b><br />
<br />
<b>Fatal error</b>:  Cannot instantiate non-existent class:  net_smtp in <b>/usr/share/pear/Mail/smtp.php</b> on line <b>150</b><br />
Any ideas on how to use this class for sending mail from a cron script?

Posted: Fri Nov 17, 2006 10:13 am
by neophyte
Looks like you've got multiple failed dependencies. This file is requires this one and on and on and on...

You could try executing the file by dropping it in to your webroot and retrieve it with wget http://whatever.com/dug.php

Posted: Fri Nov 17, 2006 10:55 am
by Chris Corbyn
Nah... php.ini isn't being loaded when you use the CLI. You just need to tell it where your php.ini file is ;)

I think it's the "-l" option if I remember correctly.

EDIT | It's the "-c" flag.