title: Why is my css file not being read in yii mailer?
body: <p>I have an email controller with the following function inside</p>
  <pre><code>public function actionCreate()
  {
  $invoice_number_1 = Yii::$app-&gt;request-&gt;post('invoice_number_1');
  $part_number_1 = Yii::$app-&gt;request-&gt;post('part_number_1');
  $quantity_1 = Yii::$app-&gt;request-&gt;post('quantity_1');
  $reason_code_1 = Yii::$app-&gt;request-&gt;post('reason_code_1');
  // There are more of these but they work fine
  
  Yii::$app-&gt;mailer-&gt;compose(
  [
      'html'=&gt;'email/myfile.php'
  ], 
  [
      'invoice_number_1' =&gt; $invoice_number_1,
      'part_number_1' =&gt; $part_number_1,
      'quantity_1' =&gt; $quantity_1,
      'reason_code_1' =&gt; $reason_code_1,
      // There are more of these but they work fine
  ])
  -&gt;setFrom([Yii::$app-&gt;params['fromEmailAddress'] =&gt; Yii::$app-&gt;params['fromEmailName']])
  // There are more of these but they work fine
  -&gt;send();
  }
  </code></pre>
  <p>The html file this links to is identical to the one is the same as in the example on the yii website but with two content security policy meta links and a link to my css as follows:
  &lt;?php
  use yii\helpers\Html;</p>
  <pre><code>/* @var $this \yii\web\View view component instance */
  /* @var $message \yii\mail\MessageInterface the message being composed */
  /* @var $content string main view render result */
  ?&gt;
  &lt;?php $this-&gt;beginPage() ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=&lt;?= Yii::$app-&gt;charset ?&gt;&quot; /&gt;
      &lt;meta http-equiv=&quot;Content-Security-Policy&quot; context=&quot;style-src 'self' 'unsafe-inline'&quot; /&gt;
      &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;style-src-elem 'self' 'unsafe-inline'&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;../credit_request/credit_request.css&quot; /&gt;
      &lt;title&gt;&lt;?= Html::encode($this-&gt;title) ?&gt;&lt;/title&gt;
      &lt;?php $this-&gt;head() ?&gt;
  &lt;/head&gt;
      &lt;body&gt;
          &lt;?php $this-&gt;beginBody() ?&gt;
          &lt;?= $content ?&gt;
          &lt;?php $this-&gt;endBody() ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php $this-&gt;endPage() ?&gt;
  </code></pre>
  <p>I have also changed the html file to just</p>
  <pre><code>&lt;?php
  use yii\helpers\Html;
  
  /* @var $this \yii\web\View view component instance */
  /* @var $message \yii\mail\MessageInterface the message being composed */
  /* @var $content string main view render result */
  ?&gt;
  &lt;?php $this-&gt;beginPage() ?&gt;
  &lt;?php $this-&gt;beginBody() ?&gt;
      &lt;?= $content ?&gt;
  &lt;?php $this-&gt;endBody() ?&gt;
  &lt;?php $this-&gt;endPage() ?&gt;
  </code></pre>
  <p>and it gives the same result.</p>
  <p>The email/index.php page is as follows</p>
  <pre><code>&lt;!DOCTYPE html &gt;
  &lt;html &gt;
      &lt;head&gt;
          &lt;meta charset=&quot;utf-8&quot;&gt;
          &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
          &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;style-src 'self' 'unsafe-inline'&quot;&gt;
          &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;style-src-elem 'self' 'unsafe-inline'&quot;&gt;
          &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
          &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;./credit_request.css&quot; /&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class=&quot;container_1&quot;&gt;
              &lt;span class=&quot;numbers_1&quot; &gt;&lt;?php echo strtoupper($invoice_number_1) ?&gt; &amp;emsp; - &amp;emsp; &lt;?php echo strtoupper($part_number_1) ?&gt; &amp;emsp; x &amp;emsp; &lt;?php echo strtoupper($quantity_1) ?&gt; &amp;emsp;&lt;/span&gt;
              &lt;span class=&quot;reason_code_1&quot;&gt;&lt;?php echo strtoupper($reason_code_1)?&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>When I send an email I get the following error referring to the link in the html file:</p>
  <p>Refused to load the stylesheet 'http://192.168.0.90/email/index.css' because it violates the following Content Security Policy directive: &quot;style-src 'unsafe-inline'&quot;. Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback.</p>
  <p>I also get the following three errors referring to the link in the email/index.php file:</p>
  <p>The Content Security Policy 'style-src 'self' 'unsafe-inline'' was delivered via a  element outside the document's , which is disallowed. The policy has been ignored.</p>
  <p>The Content Security Policy 'style-src-elem 'self' 'unsafe-inline'' was delivered via a  element outside the document's , which is disallowed. The policy has been ignored.</p>
  <p>Refused to load the stylesheet 'http://192.168.0.90/otrs/index.css' because it violates the following Content Security Policy directive: &quot;style-src 'unsafe-inline'&quot;. Note that 'style-src-elem' was not explicitly set, so 'style-src' is used as a fallback.</p>
  <p>My css file is just</p>
  <pre><code>.container_1 {
      background-color: red;
  }
  </code></pre>
  <p>How do I get the css to be recognised?</p>