title: Send file attachment with SendGrid PHP (sendgrid-php library)
body: <p>When I try to send an attachment using the SendGrid PHP library (<a href="https://github.com/sendgrid/sendgrid-php" rel="nofollow">https://github.com/sendgrid/sendgrid-php</a>), the function fails (white screen).  Removing the "setAttachment" line makes it work again.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>require "sendgrid-php/sendgrid-php.php";
  function sendgrid() {
  
     $recips = array("me@mydomain.ca");
     $categories = array("test");
  
  
  
     $sendgrid = new SendGrid("API key removed");
  
     $email = new SendGrid\Email();
     $email
     -&gt;setSmtpapiTos($recips)
     -&gt;setFrom('mailroom@mydomain.ca')
     -&gt;setSubject('Testing Sendgrid')
     -&gt;setText('Hello World! Testing...')
     -&gt;setHtml('&lt;strong&gt;Hello World!&lt;/strong&gt;')
     -&gt;setCategories($categories)
     -&gt;setAttachment('test.txt')
     ;
  
  
     //$sendgrid-&gt;send($email);
  
     $res = $sendgrid-&gt;send($email);
  
     var_dump($res);
  }
  
  sendgrid();
  </code></pre>
  
  <p>As far as I can tell, I'm following the documentation, but I wonder if I haven't formatted the path to the file correctly.  "Test.txt" is in the same directory as the file that contains the above code.</p>
  
  <p>Can anyone offer any suggestions?</p>