Looking at the exchange logs, the last thing that the exchange server
says is
2006-03-22 20:42:11 4.79.181.18 OutboundConnectionResponse SMTPSVC1
mailserver - 25 - - 354+go+ahead 0 0 12 0 437 SMTP - - - -
I don't do Exchange, so I don't know what all that means. It's not exactly
transparent in meaning is it? Is that the server accepting the message from the
client, or the server attempting to forward it on?
If it's the Exchange server forwarding the message, and the 437 is a reply code
from the external MTA then that indicates a transient error. A 4xx reply code
indicates that was the message was ok, but the receiving MTA was unable to
process the message at the current time - please call again later. Always
supposing that Microsoft obey the accepted protocols...
Does JavaMail put a <CRLF>.<CRLF> automatically at the end of the
message?
It does everything required to compose a correct message. If it didn't the
Exchange server should not have accepted it.
Here is a snippet of code I use to send new users a "welcome" message (which
automatically generates their mail account) when I register them:
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", ConfigurationData.getMailServer());
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress("xxx@yyy"));
message.addRecipient(Message.RecipientType.TO, new
InternetAddress(recipient));
message.setSubject("Welcome to the Space Plasma Physics mail system");
message.setText("This is a test message to ensure that email is working.");
// Send message
Transport.send(message);
As you can see, there's not a lot to it. There certainly is no need to terminate
the message with a <CR><LF>.<CR><LF>. That is part of the transmission protocol
and is handled by Transport.send() for SMTP.