Hi, Well, but the SendFailedException already does it.=20 Why don't u try to collect from the other methods those addresses: Address[] getInvalidAddresses()=20 Return the addresses to which this message could not be sent.=20 Address[] getValidSentAddresses()=20 Return the addresses to which this message was sent succesfully.=20 Address[] getValidUnsentAddresses()=20 Return the addresses that are valid but to which this message was not sent.=20
Try to call getValidUnsentAddresses() and getValidSentAddresses() and tell us what u get. []s, -----Mensagem original----- De: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]]Em nome de Joe Schell Enviada em: quarta-feira, 4 de dezembro de 2002 21:08 Para: [EMAIL PROTECTED] Assunto: Re: Problem catching InvalidEmail Addresses ssmtech wrote: > Thanks a lot for your reply,but i am little confused about what > you are tring to tell me.Can you be a little more specific about it,some > code enhancement or some thing Your exception has this in it "... javax.mail.SendFailedException: 554 <[EMAIL PROTECTED]>:..." So it has the email address in it. So you parse it looking either for "SendFailedException:" or just "<" and then extract the address from there. To parse it you can use any of a variety of methods including the indexOf() method of String, or StringTokenizer, or a regex engine such as the one that comes with java 1.4. > ----- Original Message ----- > From: "Joe Schell" > > > > >ssmtech wrote: > > > > > > > > But the problem is that ,if an Invalid Email Address is > > > encountered and after throwing me an SendFailedException if i try to > > > Catch the Invalid Address ,like > > > *Address[] invalid = sfe.getInvalidAddresses();* > > > and print an SOP after this, > > > * System.out.println("Collected InvalidAddress from > > > SendFailedException...."+invalid);* > > > the SOP prints "*Null*" ... > > > > > > The Invalid Email Address is also an well Formed String....e.g... > > > "*[EMAIL PROTECTED]"...* > > > The complete Exception is ..... > > > > > > >The solution seems obvious to me. Extract the email from the string > >rather than the array. > > > >Presumably you are also aware that there is no guarantee that an email > >was received just because you don't get an error correct? > > > > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
