<p>Although the <a href="https://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/examples/template-variables" rel="nofollow noreferrer">Sprout Email docs</a> state it is preferable to use shorthand syntax for variables in notifications, I found this to not be the case for the Notification subject line.</p>

<p>So using <code>{companyName}</code> in the subject would cause the issue shown above.</p>

<p><code>{{object.companyName}}</code> fixes this.</p>

CC BY-SA 3.0
2017-11-07T12:28:21.260Z
2017-11-07T17:52:05.697Z
2017-11-07T17:52:05.697Z
Adam Menczykowski
<p>Sprout Forms 2.5.1
Sprout Email 3.0.3</p>

<p>I am getting the error "Internal Server Error - Illegal string offset 'template'"</p>

<p>I have updated the template file to use <code>email</code> variable instead of <code>entry</code> for the html and text content respectively.</p>

<p>Stack trace: </p>

<p><code>******************************************************************************************************
    2017/11/06 20:38:21 [error] [php] Illegal string offset 'template' (/home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php:212)
    Stack trace:
    #0 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php(69): Craft\SproutEmailService-&gt;error()
    #1 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php(468): Craft\SproutEmailService-&gt;renderObjectTemplateSafely()
    #2 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/integrations/sproutemail/mailers/SproutEmail_DefaultMailer.php(99): Craft\SproutEmailService-&gt;renderEmailTemplates()
    #3 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(487): Craft\SproutEmail_DefaultMailer-&gt;sendNotificationEmail()
    #4 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(383): Craft\SproutEmail_NotificationEmailsService-&gt;relayNotificationThroughAssignedMailer()
    #5 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(359): Craft\SproutEmail_NotificationEmailsService-&gt;handleDynamicEvent()
    #6 unknown(0): Craft\SproutEmail_NotificationEmailsService-&gt;Craft\{closure}()
    #7 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(298): call_user_func_array()
    #8 /home/forge/www.sitename.co.uk/craft/app/framework/base/CComponent.php(567): Craft\SproutEmail_NotificationEmailsService-&gt;Craft\{closure}()
    #9 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutFormsService.php(79): Craft\SproutFormsService-&gt;raiseEvent()
    #10 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutForms_EntriesService.php(246): Craft\SproutFormsService-&gt;onSaveEntry()
    #11 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutForms_EntriesService.php(195): Craft\SproutForms_EntriesService-&gt;callOnSaveEntryEvent()
    #12 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/controllers/SproutForms_EntriesController.php(162): Craft\SproutForms_EntriesService-&gt;saveEntry()
    #13 /home/forge/www.sitename.co.uk/craft/app/framework/web/actions/CInlineAction.php(49): Craft\SproutForms_EntriesController-&gt;actionSaveEntry()
    #14 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams()
    #15 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(286): Craft\SproutForms_EntriesController-&gt;runAction()
    #16 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(265): Craft\SproutForms_EntriesController-&gt;runActionWithFilters()
    #17 /home/forge/www.sitename.co.uk/craft/app/framework/web/CWebApplication.php(282): Craft\SproutForms_EntriesController-&gt;run()
    #18 /home/forge/www.sitename.co.uk/craft/app/etc/web/WebApp.php(823): Craft\WebApp-&gt;runController()
    #19 /home/forge/www.sitename.co.uk/craft/app/etc/web/WebApp.php(287): Craft\WebApp-&gt;_processActionRequest()
    #20 /home/forge/www.sitename.co.uk/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&gt;processRequest()
    #21 /home/forge/www.sitename.co.uk/craft/app/index.php(62): Craft\WebApp-&gt;run()
    #22 /home/forge/www.sitename.co.uk/public/index.php(19): require_once()
    REQUEST_URI=/contact-us
</code></p>

<plugin-sproutforms><plugin-sproutemail>
Sprout Forms + Email - internal server error
# Sprout Forms + Email - internal server error

(Asked by: username_0 on 2017-11-07)

Sprout Forms 2.5.1
Sprout Email 3.0.3

I am getting the error "Internal Server Error - Illegal string offset 'template'"

I have updated the template file to use `email` variable instead of `entry` for the html and text content respectively.

Stack trace:

`******************************************************************************************************
2017/11/06 20:38:21 [error] [php] Illegal string offset 'template' (/home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php:212)
Stack trace:
#0 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php(69): Craft\SproutEmailService->error()
#1 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmailService.php(468): Craft\SproutEmailService->renderObjectTemplateSafely()
#2 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/integrations/sproutemail/mailers/SproutEmail_DefaultMailer.php(99): Craft\SproutEmailService->renderEmailTemplates()
#3 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(487): Craft\SproutEmail_DefaultMailer->sendNotificationEmail()
#4 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(383): Craft\SproutEmail_NotificationEmailsService->relayNotificationThroughAssignedMailer()
#5 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(359): Craft\SproutEmail_NotificationEmailsService->handleDynamicEvent()
#6 unknown(0): Craft\SproutEmail_NotificationEmailsService->Craft\{closure}()
#7 /home/forge/www.sitename.co.uk/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php(298): call_user_func_array()
#8 /home/forge/www.sitename.co.uk/craft/app/framework/base/CComponent.php(567): Craft\SproutEmail_NotificationEmailsService->Craft\{closure}()
#9 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutFormsService.php(79): Craft\SproutFormsService->raiseEvent()
#10 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutForms_EntriesService.php(246): Craft\SproutFormsService->onSaveEntry()
#11 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/services/SproutForms_EntriesService.php(195): Craft\SproutForms_EntriesService->callOnSaveEntryEvent()
#12 /home/forge/www.sitename.co.uk/craft/plugins/sproutforms/controllers/SproutForms_EntriesController.php(162): Craft\SproutForms_EntriesService->saveEntry()
#13 /home/forge/www.sitename.co.uk/craft/app/framework/web/actions/CInlineAction.php(49): Craft\SproutForms_EntriesController->actionSaveEntry()
#14 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams()
#15 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(286): Craft\SproutForms_EntriesController->runAction()
#16 /home/forge/www.sitename.co.uk/craft/app/framework/web/CController.php(265): Craft\SproutForms_EntriesController->runActionWithFilters()
#17 /home/forge/www.sitename.co.uk/craft/app/framework/web/CWebApplication.php(282): Craft\SproutForms_EntriesController->run()
#18 /home/forge/www.sitename.co.uk/craft/app/etc/web/WebApp.php(823): Craft\WebApp->runController()
#19 /home/forge/www.sitename.co.uk/craft/app/etc/web/WebApp.php(287): Craft\WebApp->_processActionRequest()
#20 /home/forge/www.sitename.co.uk/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#21 /home/forge/www.sitename.co.uk/craft/app/index.php(62): Craft\WebApp->run()
#22 /home/forge/www.sitename.co.uk/public/index.php(19): require_once()
REQUEST_URI=/contact-us`

**Tags:** plugin-sproutforms, plugin-sproutemail


---

## 1 answers

### Answer by username_0 on 2017-11-07. Score: 1

Although the [Sprout Email docs](https://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/examples/template-variables) state it is preferable to use shorthand syntax for variables in notifications, I found this to not be the case for the Notification subject line.

So using `{companyName}` in the subject would cause the issue shown above.

`{{object.companyName}}` fixes this.


---

