RE: [PEAR] Mail::factory issue
| From: | LIMBOURG Arnaud | Date: | Wed, 30 Jul 2003 08:42:13 +0000 |
| Subject: | RE: [PEAR] Mail::factory issue | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6915@lists.php.net to get a copy of this message | ||
$headers['From'] = 'me@example.com';
$headers['To'] = $recipient;
$headers['Subject'] = 'Blah';
$params['host'] = SMTP_SERVER;
$mail_object =& Mail::factory('smtp', $params);
$sent = $mail_object->send($recipient, $hdrs, $body);
if (PEAR::isError($sent)) {
die('cannot send mail');
}
From your code your forgot params and thus the class does not where to
connect.
Arnaud.
> Here is a section of code:
>
> print("creating");
> $mail =& Mail::factory('smtp');
> print("sending");
> $mail->send('andrew@copeandmcphetres.com', $hdrs, $body);
> if(PEAR::isError($mail))
> print("Error");
>
> If I run this I only get the "creating" printed, never gets
> to the send
> function. All of the defaults for smtp should be OK (localhost:25,
> etc). Any ideas on this?
>
> Andrew.