我正在运行一个JBoss服务器,其底层是Postfix服务器。当我发送电子邮件时,JavaMail会创建一个无效的messageID,例如Message ID:<47112553203.139.4972667128159.JavaMail.未定义>。
我正在使用此代码发送邮件:
Properties props = new Properties();
props.put("mail.smtp.host", "xxx.tld");
props.put("mail.host", "xxx.tld");
InitialContext ictx = new InitialContext(props);
Session sess = (Session) ictx.lookup("java:jboss/mail/Default");
Transport trans = sess.getTransport("smtp");
trans.connect();
MimeMessage msg = new MimeMessage(sess);
msg.setFrom(new InternetAddress(from));
msg.addRecipients(RecipientType.TO, InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(message);
msg.setHeader("Content-Type", "text/html; charset=\"utf-8\"");
msg.saveChanges();
Transport.send(msg, msg.getAllRecipients());
trans.close();
主要的后缀配置:
myhostname = xxx.tld
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = xxx.tld, Debian-60-squeeze-64-minimal, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = 127.0.0.1
我该如何解决此问题?
顺致敬意,
基督教的