Template path from plugin not working from CP I've written a plugin that sends and email to a user group on new entry save in a particular section. Most entries will be made from the front end, and the plugin is working great in that regard. However, if a user attempts to create a new entry from the CP, the plugin cannot find my designated template path and throws an error. Any help is greatly appreciated. 

if ($isNewEntry and $entrySection == 'Questions')
{
    //Get all users from UserGroup
    $user_criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::User);
    $user_criteria-&gt;groupId = '9';
    $users = $user_criteria-&gt;find();
    $template = '/email/question-email.html';

    //Send to each User
    foreach ($users as $user)
    {
        //Send Mail
        $email = new EmailModel();
        $email-&gt;toEmail = $user-&gt;email;
        $email-&gt;subject = 'New Question';
        $email-&gt;htmlBody = "{% extends '{$template}' %}".
            "{% set body %}".
            '
            &lt;p&gt;A new question has been posted by '.$entry-&gt;author-&gt;name.':&lt;/p&gt;

            &lt;h2&gt;Question: '.$entry-&gt;title.'&lt;/h2&gt;

            &lt;p&gt;Description: '.$entry-&gt;questionDetails.'&lt;/p&gt;

            &lt;p&gt;Attachments: '.$entry-&gt;questionAttachments-&gt;total().'&lt;/p&gt;

            &lt;p&gt;&lt;a style="color: #09c;" href="'.$entry-&gt;url.'" title="'.$entry-&gt;title.'"&gt;&lt;b&gt;Answer Question&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;
                        '
            ."{% endset %}";

        craft()-&gt;email-&gt;sendEmail($email);
    }
}
You probably just need to call PathService::setTemplatesPath() and pass in the path to your plugin's template folder.

It would look something like:

// Save the current template path.
$originalPath = craft()-&gt;path-&gt;getTemplatesPath();

// Set your plugin's template path.
$path = craft()-&gt;path-&gt;getPluginsPath().'/mypluginfolder/templates/';
craft()-&gt;path-&gt;setTemplatesPath($path);

//Send to each User
foreach ($users as $user)
{
    //Send Mail
    $email = new EmailModel();
    $email-&gt;toEmail = $user-&gt;email;
    $email-&gt;subject = 'New Question';
    $email-&gt;htmlBody = "{% extends '{$template}' %}".
        "{% set body %}".
        '
        &lt;p&gt;A new question has been posted by '.$entry-&gt;author-&gt;name.':&lt;/p&gt;

        &lt;h2&gt;Question: '.$entry-&gt;title.'&lt;/h2&gt;

        &lt;p&gt;Description: '.$entry-&gt;questionDetails.'&lt;/p&gt;

        &lt;p&gt;Attachments: '.$entry-&gt;questionAttachments-&gt;total().'&lt;/p&gt;

        &lt;p&gt;&lt;a style="color: #09c;" href="'.$entry-&gt;url.'" title="'.$entry-&gt;title.'"&gt;&lt;b&gt;Answer Question&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;
                    '
        ."{% endset %}";

    craft()-&gt;email-&gt;sendEmail($email);
}

// Reset the original path.
craft()-&gt;path-&gt;setTemplatesPath($originalPath);