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 issue

October 13, 2010 6:21am

Subscribe [4]
  • #1 / Oct 13, 2010 6:21am

    nanoxo

    10 posts

    Hi,

    I’m trying sending emails to users when they properly enter some new data.

    Actually i’m using this :

    {exp:channel:entries channel="Fiche" author_id="CURRENT_USER" }
    <?php
    $subject = "bla";
    $message = "bla";
    
    $this->EE->load->library('email'); 
    
    $this->EE->email->wordwrap = true;
    $this->EE->email->debug = true;
    $this->EE->email->mailtype = 'html';
        
    //envoi au client
    $this->EE->email->from('[email protected]');
    $this->EE->email->to("{mail}"); 
    
    $this->EE->email->subject($subject);
    $this->EE->email->message($message);
    $this->EE->email->Send();
    ?>
    {/exp:channel:entries}

    it works if i use :

    $this->EE->email->to("[email protected]");

    it doesn’t with :

    $this->EE->email->to("{mail}");

    My variable is well retrieved and i can ‘echo’ it.
    Switching php mode between ‘output/input’ doesn’t solve my probleme either.

  • #2 / Oct 13, 2010 3:10pm

    Ingmar

    29245 posts

    What version and build are you using? What’s {mail}, a custom channel field?

  • #3 / Jan 20, 2011 3:22am

    Nicolas Bottari

    143 posts

    I think a reference to the ExpressionEngine super object is missing for this to work:

    <?php
        // Make a local reference to the ExpressionEngine super object
        $this->EE =& get_instance();
    ?>

    Also, setting PHP to “Output” should parse your {mail} tag before the PHP kicks in.

  • #4 / Jan 20, 2011 9:54am

    Sue Crocker

    26054 posts

    Thanks for the assist, Nicolas. Since this thread is quite old, closing thread.

    If anything else comes up, please start a new thread so that we can help you.

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

ExpressionEngine News!

#eecms, #events, #releases