[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sup-talk] hook with external file ref



Hi David.
Excerpts from Philippe LeCavalier's message of Thu Mar 03 14:12:40 -0500 2011:
> Thank you David.
> Excerpts from David J. Hamilton's message of Thu Mar 03 12:35:20 -0500 2011:
> > Excerpts from Philippe LeCavalier's message of Thu Mar 03 05:26:03 -0800 2011:
> > > From: Philippe LeCavalier <support@plecavalier.com>
> > > To: sup-talk <sup-talk@rubyforge.ord>
> > > Cc: 
> > > Bcc: 
> > > Subject: hook with external file ref
> > > 
> > > addressfile = File.open("/home/user/path/addressfile","r")
> > > if ! addressfile.grep(/#{message.from.email}/).empty?
> > >   message.add_label :somelabel
> > > end
> > > 
> > > In the wiki it states "which contains one e-mail address per line". I'm just
> > > wondering what I would have to change in the code in order to list just the
> > > domain.
> > 
> > It's a bit tricky because you're trying to find the email address in the
> > address file, rather than match one of many patterns in the address file to the
> > email.  If you use the latter approach you should be able to put whatever
> > patterns you want, including just the domain.
> > 
> >   patterns = File.readlines "/path/to/my/addressfile"
> >   patterns.each do |pattern|
> >     if message.from.email =~ /#{pattern}/
> >       message.add_label :somelabel
> >     end
> >   end
I'm getting "undetermined quoted string" with the above code. Any ideas?

-- 
Thanks,
Phil
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk