Welcome Guest, Not a member yet? Register   Sign In
Email Library woes
#1

[eluser]stuffradio[/eluser]
I'm using my own library to send email.

Code:
<?php

class Sendemaillib
{

  var $toUser;
  var $fromUser;
  var $theSubject;
  var $theMessage;

  function Sendemaillib()
  {
    $this->CI =& get_instance();
    $this->CI->load->library('email');
  }

  function sendIt()
  {
    if (isset($this->toUser) && isset($this->fromUser) && isset($this->theSubject) && isset($this->theMessage))
    {
      $this->CI->from($this->fromUser, 'Dean F');
      $this->CI->reply_to($this->fromUser, 'Dean F');
      $this->CI->to('[email protected]');
      $this->CI->subject($this->theSubject);
      $this->CI->message($this->theMessage);
      $this->CI->send();
    } else {
      $errors = array('error' => 'Not everything is set!');
      return $errors;
    }

    }

}

Whenever I try using this library, I get a blank page and Apache throws the following error:
Quote:PHP Fatal error: Call to undefined method Picture::from() in /var/www/vhosts/xxxxx/httpdocs/system/application/libraries/sendemaillib.php on line 21, referer: xxxxx/index.php/picture/id/2

Line 21 is
Quote: $this->CI->from($this->fromUser, 'Dean F');

The code using this is:

Code:
$this->sendemaillib->toUser = $getUser->email;
    $this->sendemaillib->fromUser = '[email protected]';
    $this->sendemaillib->theSubject = 'You got a new comment on an image!';
    $this->sendemaillib->theMessage = 'This is a test message!';
    $this->sendemaillib->sendIt();

Hope you can help!!!


Messages In This Thread
Email Library woes - by El Forum - 07-14-2008, 05:38 PM
Email Library woes - by El Forum - 07-15-2008, 04:06 AM
Email Library woes - by El Forum - 07-15-2008, 10:33 AM
Email Library woes - by El Forum - 07-15-2008, 12:32 PM
Email Library woes - by El Forum - 07-15-2008, 04:29 PM
Email Library woes - by El Forum - 07-16-2008, 01:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB