PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
send() undefined?

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
hill79



Joined: 02 Apr 2008
Posts: 5

PostPosted: Wed Apr 02, 2008 1:20 pm    Post subject: send() undefined? Reply with quote

I've just installed the Mail package and can't get it to work correctly. I also installed the net_smtp and net-socket dependencies.

When I run this script...

Code:


require_once "Mail.php";

$recipients = 'me@mydomain.co.uk';

$headers['From']    = 'shopping@xxxx.com';
$headers['To']      = 'me@mydomain.co.uk';
$headers['Subject'] = 'Test message';

$body = 'Test message';

//$params['sendmail_path'] = '/usr/lib/sendmail';

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('sendmail', $params);

$mail_object->send($recipients, $headers, $body);


I get this output

Quote:

Fatal error: Call to undefined function: send() in C:\Home\f\o\foodlocalfood.co.uk\mailtest.php on line 48


any ideas anyone?
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Wed Apr 02, 2008 5:32 pm    Post subject: Reply with quote

Maybe an issue with the include_path setting?

Please add after
Code:
$mail_object =& Mail::factory('sendmail', $params);
an error check:
Code:

if (PEAR::isError($mail_object)) {
    die($mail_object->getMessage . ', ' . $mail_object->getDebugInfo());
}
Back to top
View user's profile Send private message
hill79



Joined: 02 Apr 2008
Posts: 5

PostPosted: Wed Apr 02, 2008 5:37 pm    Post subject: Reply with quote

thanks for the reply, although I don't think the output from that debug script is going to help much! this is what I get...

Code:
,


and that's it! literally just a comma!
Back to top
View user's profile Send private message
hill79



Joined: 02 Apr 2008
Posts: 5

PostPosted: Wed Apr 02, 2008 5:44 pm    Post subject: Reply with quote

never mind - resorted to using phpmailer which I got working with SMTP within 20mins!
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1053

PostPosted: Wed Apr 02, 2008 6:29 pm    Post subject: Reply with quote

If you're still interested in finding out what the problem was, you can retry it with my code snippet, but with a little correction:
It needs to be $mail_object->getMessage() instead of just $mail_object->getMessage.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software