Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javax.mail.Transport

Status
Not open for further replies.

191085

Technical User
Jun 6, 2005
2
PL
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.
 
- Are you sure your dialog.get*() methods are returning correct data ?

- How are you creating your session instance ? Are you adding the smpt host correctly ?

- Is there an exception thrown ? Its generally a good idea to print out the stack trace fully to give you an idea of what went wrong - try using :

Code:
e.printStackTrace(System.err);



--------------------------------------------------
Free Database Connection Pooling Software
 
Thank you, sedj. The session and methods are correct. Thanks to your advance I found the numbers of errors - one is 504 (authentification, so it's quite easy to solve once you know what it is) and the second - 554 (which I do not know what to do with; but at least I know what is wrong here).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top