PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail » Bug #8705

Using $this when not in object context

Details

Submitted2006-09-15 01:31 UTC
Fromblindcopy00-spam at yahoo dot com
StatusBogus
PackageMail
PHP Version5.1.4
OSWindows
Roadmaps(Not assigned)

Comments

[2006-09-15 01:31 UTC] blindcopy00-spam at yahoo dot com

Description:
------------
This is the error I get
Fatal error: Using $this when not in object context in C:\PHP\PEAR\Mail.php on line 90

Using default Windows php-5.1.4 php.ini with mysql dll uncommented.

Here is the code snippet. Please insert your own values for the variables.

$backend = 'smtp';

$headers['From'] = $from;
$headers['Subject'] = $subject;

$params["host"] = $host;
$params["username"] = $username;
$params["password"] = $password;
$params["auth"] = TRUE;
$params["debug"] = TRUE;

//create the mail object
$mail_object =& Mail::factory($backend, $params);
//send the email
Mail::send($to, $headers, $body)

[2006-09-15 01:34 UTC] chagenbu at php dot net

Your code is wrong. You can't call send() statically.

[2006-09-15 01:50 UTC] blindcopy00-spam at yahoo dot com

It works fine on my linux server. Just have the problem on windows.

if I try:
$mail_object->send($to, $headers, $body);

in place of:
Mail::send($to, $headers, $body);

it times out : DEBUG:QUIT