Pear's Mail Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Pear's Mail Function

Post 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?
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Post Reply