need help with using Mail.php
| From: | Paula Fether | Date: | Wed, 18 Oct 2006 15:38:48 +0000 |
| Subject: | need help with using Mail.php | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-25520@lists.php.net to get a copy of this message | ||
Hi, I'm trying to send simple emails from a website. I used to just use
"mail()" but noticed that if someone reads the headers they can see
information about the webhost that I'd rather not send, so I tried Mail.php.
At first it couldn't find the program so I downloaded it. Then I wrote the
following test code:
<?php
require_once "Mail.php"; // use PEAR
$recipients = "you@mail.com"; $headers["From"] = "me@mail.com"; $headers["To"] = "you@mail.com"; $headers["Subject"] = "test with remote host";$body = "just testing some more now";
$params["host"] = "mail.me.com"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "owner@me.com"; $params["password"] = "mypassword";$mail_object = &Mail::factory("smtp", $params); $mail_object = Mail::send($recipients, $headers, $body); if (PEAR::isError($mail_object)) { echo("<p>" . $mail_object->getMessage() . "</p>"); }else{ echo("<p>Message successfully sent!</p>"); } ?> But it gives the error "*Fatal error*: Call to a member function on a non-object in */mypath.com/Mail.php* on line *90*". That's where Mail calls "function send($recipients, $headers, $body)". Help please? Paula Fether