New to using Expression Engine Classes and not sure how to use the Email class. I created the class and placed it within my template, but now i get a Parse Error. Again new to EE. How would I go about using this class, such as submitting the input fields. Here is my code.

<form method="post" id="vara-registration">
        ee()->email->wordwrap = true;
        ee()->email->mailtype = 'text';
          $errors = array();

          foreach($member_emails as $username => $from)
        ee()->email->subject(" Registration Request");
        ee()->email->set_alt_message('User has requested Login verfication');

    if ( ! ee()->email->send())
        $errors[] = ee()->email->print_debugger();

        // Send failed, data was not cleared

    <p><label for="name">Name</label><input type="text" name="name" id="name_sec" value=""></p>
            <p><label for="phone">Phone</label><input type="text" name="phone" id="phone_sec" value=""></p>     
            <p><label for="Email">Email</label><input type="text" name="email" id="email" value=""></p>
            <p><input type="submit"></p>

I'm a little confused as to what you're trying to accomplish. Are you simply trying to email contents of a form submission? If so, there's no need for you to be using PHP in templates and using the email library.

ExpressionEngine has an email module built in, which allows you to email form submissions. You can read about the email module contact form tag in the documentation.

  • I assume I am putting more into this than necessary, but I am trying to pass a subject matter that the user cannot see. How do you go about doing that. For instance inside the subject matter is a key that if the users info is verified as correct it permits them to login and there login places them in the correct user group.. – Cam Sep 18 '13 at 16:29
  • If we're talking about registering and creating users, then you probably want to have a look at the member module: ellislab.com/expressionengine/user-guide/modules/member/… It'd be helpful to review the examples there, as it definitely seems like you're overcomplicating things. It's a rare instance when PHP is needed in templates in ExpressionEngine. – Jeremy Gimbel Sep 18 '13 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.