title: mailgun - send mail with attachment
body: <p>I am trying to send mail in symfony with attachment with the help of <code>mailgun</code></p>
  
  <p>I have referred this <a href="https://stackoverflow.com/q/14229656/2210140">Question</a>. And this <a href="https://documentation.mailgun.com/api-sending.html#sending" rel="nofollow noreferrer">Reference</a>. But didn't helped me.</p>
  
  <p>This is my function,</p>
  
  <pre><code>public function sendMail($to, $subject, $body, $attachment = null)
  {
      $mgClient = new Mailgun($this-&gt;container-&gt;getParameter('mailgun_key'));
      $domain = $this-&gt;container-&gt;getParameter('mailgun_domain');
      $content = [
          'from' =&gt; $this-&gt;container-&gt;getParameter('mailgun_from'),
          'to' =&gt; 'tester &lt;' . $to . '&gt;',
          'subject' =&gt; $subject,
          'text' =&gt; $body
      ];
      if (!empty($attachment)) {
          $result = $mgClient-&gt;sendMessage("$domain", $content);
      } else {
          $result = $mgClient-&gt;sendMessage("$domain", $content, [
              'attachment[0]' =&gt; [$attachment]
          ]);
      }
      return $result;
  }
  </code></pre>
  
  <p>In attachment, I'm passing the file path. i.e <code>/home/mypc/Downloads/test.txt</code></p>
  
  <p>But I'm receiving only blank mail. Attachment is not coming.</p>
  
  <p>Where am I wrong? Please help.</p>