我能够发送带有单个附件的电子邮件,但我找不到任何可以在单个邮件中发送多个附件的东西
try {
SendGrid sendgrid = new SendGrid(SENDGRID_USERNAME, SENDGRID_PASSWORD);
SendGrid.Email email = new SendGrid.Email();
// Get values from edit text to compose email
// TODO: Validate edit texts
email.addTo(mTo);
email.setFrom(mFrom);
email.setSubject(mSubject);
email.setText(mText);
// Attach image
if (mUri != null) {
email.addAttachment(mAttachmentName, mAppContext.getContentResolver().openInputStream(mUri));
}
// Send email, execute http request
SendGrid.Response response = sendgrid.send(email);
mMsgResponse = response.getMessage();
Log.d("SendAppExample", mMsgResponse);
} catch (SendGridException | IOException e) {
Log.e("SendAppExample", e.toString());
}
return null;
}