I am using same example as given in documentation :
public static void main(String[] args) throws Exception {
Email from = new Email("****@gmail.com");
String subject = "Sending with SendGrid is Fun";
Email to = new Email("****@gmail.com");
Content content = new Content("text/plain", "and easy to do anywhere, even with Java");
Mail mail = new Mail(from, subject, to, content);
SendGrid sg = new SendGrid("API KEY");
Request request = new Request();
try {
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody(mail.build());
Response response = sg.api(request);
System.out.println("response.getStatusCode() ------------------- "+response.getStatusCode());
System.out.println("response.getBody() -------- "+response.getBody());
System.out.println("response.getHeaders() -------- "+response.getHeaders());
} catch (IOException ex) {
throw ex;
}
}
I can even see response code as response.getStatusCode() ------------------- 202
But still I dont get any emails. Any more configuration needs to be done on sendgrid
side which I may be missing?