Variable Scope problem passing function parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm new to PHP 5 and classes, but I've done a lot of ActionScript.

I'm trying to use PHPMailer inside my own class (a service for AMFPHP). I'm having problems getting the data that'spassed into my class's send() method to the instance of the PHPMailer.

Basically, I have this:

class EmailAMF {
  public function send ($from, $to, $subject, $body) {
    require('class.phpmailer.php');

    $phpMail = new PHPMailer();
    $phpMail->From = $from;
    $phpMail->AddAddress($this->to);
    $phpMail->Subject = $subject;
    $phpMail->Body = $body;
    return $phpMail->Send();

  }
}

As far as I can tell, it sends an essentially blank email to nobody (but returns true.

If I replace any of my function variables with strings, like this:

   $phpMail->AddAddress('me@xxxxxxxxxxx');

the email actually "gets" that data.

What am I missing?

Thanks,
Jim

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux