Я использую java api. Я в документации по ссылке "https://github.com/sendgrid/sendgrid-java#without-mail-helper-class" копирую пример, как он есть на странице, я выполняю его, а почта не приходит. Разместите действующие адреса. Я не делаю исключения. Пожалуйста, этого не хватает
Ява
try {
SendGrid sg = new SendGrid(GlobalVariable.getInstance().getSendGridApiKey());
Request request = new Request();
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody("{\"personalizations\":[{\"to\":[{\"email\":\"[email protected]\"}],\"subject\":\"Sending with SendGrid is Fun\"}],\"from\":{\"email\":\"[email protected]\"},\"content\":[{\"type\":\"text/plain\",\"value\": \"and easy to do anywhere, even with Java\"}]}");
Response response = sg.api(request);
System.out.println(response.getStatusCode());
System.out.println(response.getBody());
System.out.println(response.getHeaders());
} catch (IOException ex) {
throw ex;
}
Консоль
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "Accept: application/json[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "User-agent: sendgrid/3.0.0;java[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "Content-Type: application/json[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "Content-Length: 232[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "Host: api.sendgrid.com[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "Connection: Keep-Alive[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:72 - http-outgoing-8 >> "[\r][\n]"
2018-12-13 16:02:12 DEBUG wire:86 - http-outgoing-8 >> "{"personalizations":[{"to":[{"email":"[email protected]"}],"subject":"Sending with SendGrid is Fun"}],"from":{"email":"[email protected]"},"content":[{"type":"text/plain","value": "and easy to do anywhere, even with Java"}]}"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "HTTP/1.1 202 Accepted[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Server: nginx[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Date: Thu, 13 Dec 2018 20:02:14 GMT[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Content-Type: text/plain; charset=utf-8[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Content-Length: 0[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Connection: keep-alive[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "X-Message-Id: Y9xK3GjoQs-3JeZ3aLO7qQ[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Access-Control-Allow-Origin: https://sendgrid.api-docs.io[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Access-Control-Allow-Methods: POST[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Access-Control-Allow-Headers: Authorization, Content-Type, On-behalf-of, x-sg-elas-acl[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "Access-Control-Max-Age: 600[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "X-No-CORS-Reason: https://sendgrid.com/docs/Classroom/Basics/API/cors.html[\r][\n]"
2018-12-13 16:02:13 DEBUG wire:72 - http-outgoing-8 << "[\r][\n]"
2018-12-13 16:02:13 DEBUG headers:124 - http-outgoing-8 << HTTP/1.1 202 Accepted
нет исключения Spara
Кажется, у вас есть HTTP/1.1 202 Accepted. Вы проверяли спам?




у вас есть исключение на консоли?