Jump to content

PEAR sendmail problems


dennismonsewicz

Recommended Posts

So I am trying to explore the avenue known as PEAR and I am getting nowhere :(

 

Here is my code:

 

 require '/usr/share/php/Mail.php';

			$recipients = '[email protected]';

			$headers['From']    = '[email protected]';
			$headers['To']      = '[email protected]';
			$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);

 

If I do not include the file using an absolute path I get the following error message:

 

Fatal Error: 'PEAR.php' is not a valid path 

 

But if I include the file with the absolute path I then get a blank page....

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/184698-pear-sendmail-problems/
Share on other sites

ok so now I am getting the following error:

 

Fatal Error: 'send' is an unknown method of 0

 

updated code:

require 'Mail.php';

			$recipients = '[email protected]';

			$headers['From']    = '[email protected]';
			$headers['To']      = '[email protected]';
			$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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.