public SendGrid.Response send(Email email) throws SendGridException { HttpPost httppost = new HttpPost(this.url + this.endpoint); httppost.setEntity(this.buildBody(email)); // Using an API key if (this.username == null) { httppost.setHeader("Authorization", "Bearer " + this.password); } try { HttpResponse res = this.client.execute(httppost); return new SendGrid.Response(res.getStatusLine().getStatusCode(), EntityUtils.toString(res.getEntity())); } catch (IOException e) { throw new SendGridException(e); } }