Demi God
Demi God

Reputation: 97

Symfony htmlTemplate doesn't work in production

Following is the email send code

$email = (new TemplatedEmail())
->from('[email protected]')
->to($applicantEmail)
->subject('Congratulations! Application Successful')
->htmlTemplate('main/email/admission_mail.html.twig')
->context(['name' => $name])
;
$mailer->send($email);

This code works fine in localhost without any issue but in production, I'm using hostinger shared host I am getting following error:

Unable to find template "main/email/admission_mail.html.twig" (looked into: /home/u511184722/domains/example.com/public_html/templates, /home/u511184722/domains/example.com/public_html/vendor/symfony/twig-bridge/Resources/views/Form).

How to resolve this

for an alternative I used

$email = (new Email())
    ->html($this->renderView('email/email.html.twig', [
        'name' => 'John Doe',
    ]));

I'm getting following error

Unable to find template "main/email/admission_mail.html.twig" (looked into: C:\wamp64\www\cin_cms/templates, C:\wamp64\www\cin_cms\vendor\symfony\twig-bridge/Resources/views/Form).

Upvotes: 0

Views: 63

Answers (0)

Related Questions