Re: Pear Mail() problem
| From: | Torsten Roehr | Date: | Sat, 04 Sep 2004 19:55:06 +0000 |
| Subject: | Re: Pear Mail() problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14410@lists.php.net to get a copy of this message | ||
"Stowe Spivey" <spiveyspivey@yahoo.com> wrote in message
news:20040904183311.43680.qmail@web40112.mail.yahoo.com...
> I THINK I have access to the PEAR packages in my /path/to/pear/...
> directory. I tested a simple php page with just :
> require("/path/to/pear/Mail.php");
> as the only php code and the page displayed properly so I assume that
> means
> my page can see that directory - I might be wrong. Is there another
> way to
> test to be sure I have access to that directory?
>
> Here's the meat of my question. Here's the code for sending the
> mail:
>
> $recipients = 'me@mydomain.com';
> $headers['From'] = 'me@mydomain.com';
> $headers['To'] = 'me@mydomain.com';
> $headers['Subject'] = 'Test message';
> $body = 'Test message';
> $params["host"] = 'smtp.mydomain.com';
> $params["auth"] = True;
> $params["username"] = 'loginID';
> $params["password"] = 'password';
> echo 1;
> $mail_object =& Mail::factory('smtp', $params);
> echo 2;
> $mail_object->send($recipients, $headers, $body);
> echo 3;
>
> It gets through "echo 2" then does NOT display 3. So, it is not
> executing
> the send command. (I am using smtp mail for a purpose).
>
> How can I test or troubleshoot form this point? Any ideas what is
> going on
> or not going on?
>
> I am very new to PEAR so please be as specific as possible.
>
> Your help is MUCH appreciated!
If <$mail_object =& Mail::factory('smtp', $params);> doesn't cause a fatal
error your include/path is correct.
send() will return a PEAR_Error object if an error occurs. Do this:
$result = $mail_object->send($recipients, $headers, $body);
print_r($result);
This will give you detailed information of what kind of error occurred.
Regards, Torsten Roehr