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

I'm using my own library to send email.


class Sendemaillib

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

  function Sendemaillib()
    $this->CI =& get_instance();

  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]');
    } 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:

$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!';

Hope you can help!!!

It seems that you have missed something - should be $this->CI->email->... instead of $this->CI->... in your sendIt() method.

I forgot to post that I tried it that way before as well... I was just trying different ways to see if it would work, but it doesn't.

So $this->CI->email doesn't work for me either.

[eluser]louis w[/eluser]
Did you change them all to $this->CI->email ?

$this->CI->email->from($this->fromUser, 'Dean F');
      $this->CI->email->reply_to($this->fromUser, 'Dean F');
      $this->CI->email->to('[email protected]');

Yeah, I already said I did :p

I solved my problem by using the native mail function. I'm not using this email library anymore because it screws up!

Theme © iAndrew 2016 - Forum software by © MyBB