From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.228.136 with SMTP id je8cs37218icb; Fri, 4 Mar 2011 06:44:59 -0800 (PST) Received: by 10.231.193.170 with SMTP id du42mr583313ibb.15.1299249898642; Fri, 04 Mar 2011 06:44:58 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id s1si5412657iba.43.2011.03.04.06.44.57; Fri, 04 Mar 2011 06:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 0CA781858392; Fri, 4 Mar 2011 09:44:57 -0500 (EST) Received: from plecavalier.com (plecavalier.com [64.40.149.83]) by rubyforge.org (Postfix) with ESMTP id 1119318581F3 for ; Fri, 4 Mar 2011 09:06:19 -0500 (EST) Received: (qmail 18070 invoked from network); 4 Mar 2011 08:06:19 -0600 Received: from xplr-142-46-160-183.xplornet.com (HELO localhost) (142.46.160.183) by plecavalier.com with (DHE-RSA-AES128-SHA encrypted) SMTP; 4 Mar 2011 08:06:18 -0600 From: Philippe LeCavalier To: Philippe LeCavalier In-reply-to: <1299179513-sup-1090@plc.intranet.plecavalier.com> References: <1299158755-sup-5116@plc.intranet.plecavalier.com> <1299173352-sup-4428@nyx.local> <1299179513-sup-1090@plc.intranet.plecavalier.com> Date: Fri, 04 Mar 2011 09:06:17 -0500 Message-Id: <1299247526-sup-7848@plc.intranet.plecavalier.com> User-Agent: Sup/0.12.1 Cc: sup-talk Subject: Re: [sup-talk] hook with external file ref X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org 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 > > > To: sup-talk > > > 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