Jack wrote: > Hello, > > I found that whenever I sent an email with james > 2.3.0/Win2k, the value of the message-id header shown > to the recipient was > <[EMAIL PROTECTED]>, where > *server* was the computer name that I set in the > control panel of Windows 2k. Such message-id is > incorrect (reason: *server* should be a domain name) > and Apache SpamAssassin may incorrectly classify the > email as spam (see > http://wiki.apache.org/spamassassin/OeSixForwardFps). > Are there any ways for me to put a valid domain name > in the message-id header, or is it a bug of james > 2.3.0? Thank you.
As far as I understand the spec I wouldn't consider this a bug because specification has no requirement for the right part of message id to be a fully qualified host name having a domain and so. http://www.ietf.org/rfc/rfc2822.txt message-id = "Message-ID:" msg-id CRLF msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS] id-right = dot-atom-text / no-fold-literal / obs-id-right dot-atom-text = 1*atext *("." 1*atext) no-fold-literal = "[" *(dtext / quoted-pair) "]" obs-id-right = domain That said: 1) Have you tried adding a domain name in your windows control panel? 2) For reference this is the code (available under the CDDL license) used by Javamail to define your message-id: ------ public static String getUniqueMessageIDValue(Session ssn) { String suffix = null; InternetAddress addr = InternetAddress.getLocalAddress(ssn); if (addr != null) suffix = addr.getAddress(); else { suffix = "[EMAIL PROTECTED]"; // worst-case default } StringBuffer s = new StringBuffer(); // Unique string is <hashcode>.<id>.<currentTime>.JavaMail.<suffix> s.append(s.hashCode()).append('.').append(id++). append(System.currentTimeMillis()).append('.'). append("JavaMail."). append(suffix); return s.toString(); } ----- And InternetAddress.getLocalAddress is here: ------ public static InternetAddress getLocalAddress(Session session) { String user=null, host=null, address=null; try { if (session == null) { user = System.getProperty("user.name"); host = InetAddress.getLocalHost().getHostName(); } else { address = session.getProperty("mail.from"); if (address == null) { user = session.getProperty("mail.user"); if (user == null || user.length() == 0) user = session.getProperty("user.name"); if (user == null || user.length() == 0) user = System.getProperty("user.name"); host = session.getProperty("mail.host"); if (host == null || host.length() == 0) { InetAddress me = InetAddress.getLocalHost(); if (me != null) host = me.getHostName(); } } } if (address == null && user != null && user.length() != 0 && host != null && host.length() != 0) address = user + "@" + host; if (address != null) return new InternetAddress(address); } catch (SecurityException sex) { // ignore it } catch (AddressException ex) { // ignore it } catch (UnknownHostException ex) { } // ignore it return null; } ----- As you can see the mail.host property of the Session would make the trick. Unfortunately in james we don't give you options to change that, but I hope this will help you to eventually change it if you create the MimeMessage in your code. Stefano > Best regards, > Jack --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
