问题描述
通过Java邮件服务发送电子邮件后,我希望获得收据,并且还希望将该收据以文本格式保存到CSV文件中,向我发送运行代码.
I want a delivery receipt after sending email through java mail service and also want to save this receipt to CSV file in text format, send me a running code.
推荐答案
要在交货时索取交货收据,您必须使用com.sun.mail.smtp.SMTPMessage.在msg中给出您的消息:
In order to request a delivery receipt you upon delivery you have to use com.sun.mail.smtp.SMTPMessage. Given your message in msg:
SMTPMessage smtpMsg = new SMTPMessage(msg);
smtpMsg.setReturnOption(SMTPMessage.RETURN_HDRS);
smtpMsg.setNotifyOptions(
SMTPMessage.NOTIFY_DELAY|SMTPMessage.NOTIFY_FAILURE|SMTPMessage.NOTIFY_SUCCESS);
现在,您将在交货时收到交货状态邮件.该邮件属于mime类型的multipart/report,sub-tpye交付状态.它由带有人类可读消息的文本/纯文本部分,具有机器可读(和标准化)消息的消息/传递状态部分以及附带原始消息的(可选)部分组成.考虑一下您要保存到文件的确切位置.
Now you will receive a delivery-status mail upon delivery. This mail is of mime-type multipart/report, sub-tpye delivery-status. It consists of text/plain part with a human readable message, a message/delivery-status part with a machine readable (and standardized) message as wells as an (optional) part with the original message attached. Think about what exactly you want to save to file.
另请参阅RFC 1891-1894.
See also RFC 1891 - 1894 for reference.
这篇关于javamail传递状态问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!