Hi,
I am trying to send an eMail from a SessionBean. This sometimes works, sometimes it throws an exception:
--- 8< snipp ------------------------------------------------------------------------------------
2004-01-04 16:51:47,166 INFO [STDOUT] Exception sending eMail: Msg: Sending failed;
nested exception is:
class javax.mail.MessagingException: 450 4.1.4 To send mail, first check your mail with a valid POP3 account; this prevents unauthorized SPAM relaying.
---------------------------------------------------------------------------------------------------
What am I doing wrong??
I understand that I first should download mails from my ISP. But that is not what I want to do. Or do I need to read index only? If so, for every mail I am sending?
Thanx for your help
Klaus
this is my code:
---------------------------------------------------------------------------------------------------
try {
javax.mail.Session mailSes = (javax.mail.Session) jndiContext.lookup("java:Mail");
MimeMessage mim = new MimeMessage(mailSes);
mim.setText("MyText");
mim.setSubject("MySubject");
InternetAddress adr = new InternetAddress("my@address", "Me");
mim.setRecipient(MimeMessage.RecipientType.TO, adr);
Transport.send(mim);
System.out.println( "Message was sent by eMal" );
}
catch (MessagingException e) {
System.out.println( "Exception sending eMail: Msg: " + e.getMessage() );
}