【发布时间】:2023-04-08 02:03:01
【问题描述】:
我在使用 lutung 的 mandrill 的 java API 时获得了一个内部服务器异常,用于获取邮件信息。这是我的代码。
public MandrillMessageInfo getMessageInfo(String id) {
MandrillApi mandrillApi = new MandrillApi("Your api key");
MandrillMessageInfo info = null;
try {
info = mandrillApi.messages().info(id);
log.debug("Message status-> Email {}, state: {}, timeOfSent: {} ", info.getEmail() ,info.getState(), TimeUtil.getLocalTimeString(info.getTs()));
} catch (Exception e) {
log.debug("Exception occurs while getting message info for id: {}, exception is: {} ", id, e.getMessage());
throw new MailServiceException(ErrorCodes.ERROR_INTERNAL_SERVER_ERROR, ErrorCodes.ERROR_MESSAGE_INTERNAL_SERVER_ERROR);
}
return info;
}
【问题讨论】:
-
您自己似乎在抛出内部服务器异常?
-
是的。但是我调用的 info() 方法会引发 MandrillApiError 异常。我的问题是我如何获取有关已发送邮件的信息?