I've got that problem with email client. I used the class Transport and method send(), but it doesn't send any message. There is an error somewhere but I cannot figure out where. Here is a part of the code:
Message newMessage = new MimeMessage(session);
newMessage.setFrom(new InternetAddress(dialog.getFrom()));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(dialog.getTo()));
newMessage.setSubject(dialog.getSubject());
newMessage.setSentDate(new Date());
newMessage.setText(dialog.getContent());
//send the message
Transport.send(newMessage);
} catch (Exception e) {
showError("Message cannot be sent.", false);
}
}
I'm completely new to java since I mostly use c++, so any help will be appreciated.
Message newMessage = new MimeMessage(session);
newMessage.setFrom(new InternetAddress(dialog.getFrom()));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(dialog.getTo()));
newMessage.setSubject(dialog.getSubject());
newMessage.setSentDate(new Date());
newMessage.setText(dialog.getContent());
//send the message
Transport.send(newMessage);
} catch (Exception e) {
showError("Message cannot be sent.", false);
}
}
I'm completely new to java since I mostly use c++, so any help will be appreciated.