title: Send Email PhantomJS With Mailgun
body: <p>I have some code to send email with phantomjs <br>
  But, i always get fail. <br>
  What's wrong with my code?</p>
  
  <pre><code>    function ObjToQs(obj) {
        str = '';
        for(key in obj) {
          str += key + '=' + obj[key] + '&amp;';
        }
        str = str.slice(0, str.length - 1);
      return str;
      }
  
      var page = require("webpage").create();
      var URL = "https://api.mailgun.net/v3/xxxxxxx.mailgun.org";
      var from = "xxx@xxx.com";
      var to = "jxxx@xxxx.com";
      var data = {
      "from" : from,
      "to" : to,
      "subject" : "Hello!",
      "text": "Test from mailgun / phantomjs"
      };
  
      page.customHeaders = {
        "Authorization": "Basic " + btoa("api:xxxx")
      }
  
      page.open(URL, "POST", data, function(status){
        if (status === "success") {
          console.log("Send Email Success!");
          var result = page.evaluate(function () {
            return document.body.innerText;
          });
  
          console.log("Log Result: " + result);
          phantom.exit();
        } else {
          console.log('FAIL to load the log');
          console.log(status);
        }
      })
  </code></pre>
  
  <p>I want to send some error log, when i run phantomjs <br>
  I've tried several times<br>
  But it still did not work<br>
  Maybe someone can help me<br></p>