Whilst testing I found that some messages in the archive I was reading
had a to: field something like
To: To: To:

When you call getRecipients() JavaMail gets annoyed and throws an
exception.
Therefore I was trying to give MailImpl() an easier life as you also
noticed that MailAddress is not very friendly in the case of a screwed
up To: field. Thus the To: field existis but cannot be parsed. As this
was pretty much the only case that caused the MailImpl(MimeMessage) I
thought I'd do some defensive programming otherwise I wouldn't have
bothered.

-- Jason

> -----Original Message-----
> From: Noel J. Bergman [mailto:[EMAIL PROTECTED] 
> Sent: 26 August 2003 20:20
> To: James Developers List
> Subject: RE: [PATCH]mbox mail repository v3
> 
> 
> Jason,
> 
> This code:
> 
>   try {
>       // Attempt to read the TO field and see if it errors
>       toAddr = 
> mimeMessage.getRecipients(javax.mail.Message.RecipientType.TO)
> .toString();
>   } catch (Exception e) {
>       // It has errored, so time for plan B
>       // use the from field I suppose
>       try {
>           
> mimeMessage.setRecipients(javax.mail.Message.RecipientType.TO,
>                                     mimeMessage.getFrom());
> 
> seems wrong.  If there is no To: field, there is no To: 
> field.  That might be important.  I have already fixed the 
> bug in MailImpl that caused it to crash (NPE).
> 
> Another problem is also something I need to fix in 
> MailImpl(MimeMessage). There is the possibility that the To: 
> field may be missing the <> (RFC 822 had bad examples), but 
> MailAddress does not tolerate it.
> 
>       --- Noel
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to