Am using sendgrid to send emails and it works fine using the following code but its without attachment.
package sendgrid;
import com.sendgrid.Content;
impor
This is the way you can send attachments using SendGrid API.
Mail mail = createEmail();
Attachments attachments = new Attachments();
Base64 x = new Base64();
String encodedString = x.encodeAsString(loadPdfFromClasspath());
attachments.setContent(encodedString);
attachments.setDisposition("attachment");
attachments.setFilename("xyx.pdf");
attachments.setType("application/pdf");
mail.addAttachments(attachments);
try {
request.method = com.sendgrid.Method.POST;
request.endpoint = "mail/send";
request.body = mail.build();
// Uncomment once connectivity with sendgrid is resolved
Response response = sg.api(request);
}catch (IOException ex) {
throw ex;
}