0
我試圖使用Google Apps Migration API v.1發送電子郵件,但是我未能發送郵件並且代碼不會引發任何異常或錯誤。 這裏是我的代碼:Google Apps遷移API批處理不會發送/插入電子郵件
MailItemService mailItemService = new MailItemService("exampleCo-exampleApp-1");
mailItemService.setUserCredentials("user","password");
MailItemEntry entry = new MailItemEntry();
Rfc822MediaSource mediaSource = new Rfc822MediaSource(mail.getInputStream().toString());
entry.setMediaSource(mediaSource);
entry.addMailProperty(MailItemProperty.STARRED);
entry.addMailProperty(MailItemProperty.UNREAD);
entry.addLabel(new Label("pruebas"));
MailItemFeed feed = new MailItemFeed();
for (int i = 0; i < mailItems.size(); i++) {
BatchUtils.setBatchId(mailItems.get(i), Integer.toString(i));
feed.getEntries().add(mailItems.get(i));
}
mailItemService.batch("domain", "destinationUser", feed);