My email.java file works only on the server and not on the client side. The script gives no errors either; and doesn't work at all when try using "cc" mailing option, but this could be a separate issue. Can anyone tell me what's happening?
Without seeing a bit of relevant code, it's hard to tell what might be going on. Are you sure there isn't an exception somewhere that is inadvertently caught and not logged?
I use Throwable, so if there is an error, it would be caught. I'm including the code producing the message... Please let me know if you see something strange there.
try {
//Get system properties Properties props = System.getProperties();
//Specify the desired SMTP server props.put("mail.smtp.host", mailHost);
// create a new Session object Session session = Session.getInstance(props);
Message message = new MimeMessage(session); Multipart Container = new MimeMultipart();
/**** text body of email ****/ BodyPart htmlText = new MimeBodyPart(); htmlText.setContent(body, "text/plain"); htmlText.setDisposition("inline"); Container.addBodyPart(htmlText);
message.setFrom(new InternetAddress(from)); message.setRecipients(Message.RecipientType.TO, new InternetAddress[] { new InternetAddress(to) });
So what happens when you run this? It just prints "message was sent" even if the message wasn't sent? Or does it send the message, but not to the CC, and then print the message?
May be it could not be able to locate mail servers.
Apache James is good starting point for dealing with Mailing applications. It provides a free SMTP, POP server and you can test stand alone mailing apps.
When I run the code, no error happens. I test it in Firefox on the server and option "to" works fine alone, but if I try "cc" (with "to"), none of them work. And if I test the code in IE - on a client machine, I can see the code pulling the data out (as long as I don't send an attachement - then I get an IO exception), says the message is sent - no errors, but option "to" doesn't work, and "cc" doesn't work...
Post by:autobot
I was her plaything! And so was this tiny ad:
a bit of art, as a gift, the permaculture playing cards