From: sto.mar@... Date: 2013-03-11T03:34:57+09:00 Subject: Re: Question regarding automating some Outlook/IMAP and pdf parsing functions w/ ruby? Am 10.03.2013 19:26, schrieb sto.mar@web.de: > Am 10.03.2013 19:17, schrieb Joel Pearson: >> In that case the 271st email in your inbox is an object which doesn't >> support SenderEmailAddress. Presumably some sort of out of office or >> server notification or something like that. >> I can't duplicate the error with my inbox but this addition might do it: >> >> if ( msg.Senderemailaddress =~ /@exampledomain.com$/i rescue false ) && >> >> Basically rescue should trigger if there's an error within that line, >> and returninf false from the expression would cause it to skip the "if" >> block. > > `rescue false' will rescue nearly all exceptions that might occur, which > is a potentially dangerous thing. Better use a begin/rescue/end block. I did not follow the start of the thread, but probably even better in this case would be to use `respond_to?' instead of relying on exceptions. --