use of com.sendgrid.SendGrid in project spring-boot by spring-projects.
the class SendGridAutoConfigurationTests method expectedSendGridBeanCreatedApiKey.
@Test
void expectedSendGridBeanCreatedApiKey() {
loadContext("spring.sendgrid.api-key:SG.SECRET-API-KEY");
SendGrid sendGrid = this.context.getBean(SendGrid.class);
assertThat(sendGrid.getRequestHeaders().get("Authorization")).isEqualTo("Bearer SG.SECRET-API-KEY");
}
use of com.sendgrid.SendGrid in project iaf by ibissource.
the class SendGridSender method open.
@Override
public void open() throws SenderException {
super.open();
httpSender.open();
CloseableHttpClient httpClient = httpSender.getHttpClient();
if (httpClient == null)
throw new SenderException("no HttpClient found, did it initialize properly?");
Client client = new Client(httpClient);
sendGrid = new SendGrid(getCredentialFactory().getPassword(), client);
}
use of com.sendgrid.SendGrid in project teammates by TEAMMATES.
the class SendgridService method sendEmailWithService.
@Override
protected void sendEmailWithService(EmailWrapper wrapper) throws IOException {
Mail email = parseToEmail(wrapper);
SendGrid sendgrid = new SendGrid(Config.SENDGRID_APIKEY);
Request request = new Request();
request.setMethod(Method.POST);
request.setEndpoint("mail/send");
request.setBody(email.build());
Response response = sendgrid.api(request);
if (isNotSuccessStatus(response.getStatusCode())) {
log.severe("Email failed to send: " + response.getBody());
}
}
Aggregations