S
Steve D. Perkins
Hey everybody -
I'm wondering if anyone's ever seen this issue before. I'm sending
plain SMTP emails in a JSP (on WebSphere 4) using JavaMail 1.3.2, and the
messages are being received with no body.
Below is the basic gist of the block of code sending the emails. I
know some things may look funny (specifying the SMTP server address in
Transport.connect() rather than in the Properties object passed to the
Session constructor, etc)... but I had some weird issues getting the app
to resolve to the right mailserver box, and this is the version of code
we came up with that actually results in emails being sent:
Session mailSession =
Session.getDefaultInstance(new Properties();, null);
MimeMessage mimeMessage = new MimeMessage(mailSession);
mimeMessage.setFrom(new InternetAddress("(e-mail address removed)"));
InternetAddress[] address =
InternetAddress.parse("(e-mail address removed)", false);
mimeMessage.setRecipients(Message.RecipientType.TO, address);
mimeMessage.setSubject("Test @ " + new Date().getTime());
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setText("This is a\ntest\n");
Multipart multiPart = new MimeMultipart();
multiPart.addBodyPart(mimeBodyPart);
mimeMessage.setContent(multiPart);
mimeMessage.setSentDate(new Date());
Transport transport = mailSession.getTransport("smtp");
transport.connect("mail.myserver.com", null, null);
transport.sendMessage(mimeMessage,
mimeMessage.getAllRecipients());
I know that the version of JavaMail shipping with WebSphere 4 is
older than 1.3.2, and this newer JAR may be unsupported and causing
compatibility issues. To be safe, we'll be reverting back to the out-of-
box configuration when the environment is rebuilt this evening. However,
my gut still tells me there has to be something else in play. Has anyone
else seen this issue before, and/or have any thoughts on what the
solution may be? Thanks in advance!
I'm wondering if anyone's ever seen this issue before. I'm sending
plain SMTP emails in a JSP (on WebSphere 4) using JavaMail 1.3.2, and the
messages are being received with no body.
Below is the basic gist of the block of code sending the emails. I
know some things may look funny (specifying the SMTP server address in
Transport.connect() rather than in the Properties object passed to the
Session constructor, etc)... but I had some weird issues getting the app
to resolve to the right mailserver box, and this is the version of code
we came up with that actually results in emails being sent:
Session mailSession =
Session.getDefaultInstance(new Properties();, null);
MimeMessage mimeMessage = new MimeMessage(mailSession);
mimeMessage.setFrom(new InternetAddress("(e-mail address removed)"));
InternetAddress[] address =
InternetAddress.parse("(e-mail address removed)", false);
mimeMessage.setRecipients(Message.RecipientType.TO, address);
mimeMessage.setSubject("Test @ " + new Date().getTime());
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setText("This is a\ntest\n");
Multipart multiPart = new MimeMultipart();
multiPart.addBodyPart(mimeBodyPart);
mimeMessage.setContent(multiPart);
mimeMessage.setSentDate(new Date());
Transport transport = mailSession.getTransport("smtp");
transport.connect("mail.myserver.com", null, null);
transport.sendMessage(mimeMessage,
mimeMessage.getAllRecipients());
I know that the version of JavaMail shipping with WebSphere 4 is
older than 1.3.2, and this newer JAR may be unsupported and causing
compatibility issues. To be safe, we'll be reverting back to the out-of-
box configuration when the environment is rebuilt this evening. However,
my gut still tells me there has to be something else in play. Has anyone
else seen this issue before, and/or have any thoughts on what the
solution may be? Thanks in advance!