JavaMail Api列表头不起作用

JavaMail Api列表头不起作用,java,email,jakarta-mail,listings,Java,Email,Jakarta Mail,Listings,我正在尝试在电子邮件标题中添加一些与列表相关的标题行,但它不起作用 msg.addHeader("List-ID", lmsg.getListId()); msg.addHeader("List-Archive", lmsg.getListId()); msg.setHeader("List-Post", lmsg.getListId()); msg.setHeader("List-Unsubscribe", lmsg.getListId()); msg.setHeader("X-Mailer"

我正在尝试在电子邮件标题中添加一些与列表相关的标题行,但它不起作用

msg.addHeader("List-ID", lmsg.getListId());
msg.addHeader("List-Archive", lmsg.getListId());
msg.setHeader("List-Post", lmsg.getListId());
msg.setHeader("List-Unsubscribe", lmsg.getListId());
msg.setHeader("X-Mailer", mailer);
msg.setSentDate(lmsg.getSendDate());
Transport.send(msg);
收到的邮件中没有任何列表标题行,但x-mailer行仍在其中

哪里是我的错


干杯

您的代码中没有明显的错误,因此需要对其进行调试。开始另外,在发送消息之前,添加msg.writeTo(newfileoutputstream(“msg.txt”);然后检查msg.txt文件,确保其中包含标题。如果是这样,而且它们仍然没有出现在收件人的邮箱中,那么沿途的一些服务器正在删除它们