ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

email class does not send

July 13, 2011 12:47pm

Subscribe [2]
  • #1 / Jul 13, 2011 12:47pm

    chrcollins

    77 posts

    EE 2.1.3 build 20110411

      I am using the Email Class to send a simple test email from inside a plugin I created.

    $this->EE =& get_instance();
    $this->EE->load->library('email');
            
    $this->EE->email->wordwrap = true;
    $this->EE->email->mailtype = 'text';
    $this->EE->email->debug = true;                
    $this->EE->email->from('[email protected]');
    $this->EE->email->to('[email protected]'); 
    $this->EE->email->subject("test");
    $this->EE->email->message("TEST");

    I get no email delivered.

    I ran email_test.php from my root directory and it worked.  I can send an email from my admin console panel.  I set email debug on in the console and set it in the email class instantiation but I get no debug messages in the template debug output. 


      Any suggestions?

  • #2 / Jul 13, 2011 2:27pm

    chrcollins

    77 posts

    Sorry my code sample up above does not show the send (cut and paste error) ...

    $this->EE->email->send();


      The actual code does have the send however.

  • #3 / Jul 13, 2011 2:49pm

    chrcollins

    77 posts

    Found the problem.  The “from” field has to be valid.  I had a careless typo in the website name.  However, I was not able to get the email to print out debug information by setting email debug flags in the code or on the control panel.  So instead I found a function in Code Igniter email class called print_debugger which returns the email debug information.  I then printed it out to the screen using the following ...

    $msg = $this->EE->email->print_debugger();    
    $this->EE->TMPL->log_item("debug:email = ".$msg);
  • #4 / Jul 13, 2011 3:27pm

    Sue Crocker

    26054 posts

    Glad you were able to figure out what the problem was. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases