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 = 'dennismonsewicz@gmail.com';

			$headers['From']    = 'me@me.com';
			$headers['To']      = 'dennismonsewicz@gmail.com';
			$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
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 = 'dennismonsewicz@gmail.com';

			$headers['From']    = 'dennismonsewicz@gmail.com';
			$headers['To']      = 'dennismonsewicz@gmail.com';
			$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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.