From 4726525a10c1d37cac2be5f4d99db75b37d64a60 Mon Sep 17 00:00:00 2001
From: Andrew Ruthven <puck@lca2010.org.nz>
Date: Tue, 1 Dec 2009 20:28:56 +1100
Subject: [PATCH] Look for both email and email_address in the YML file.

---
 merge.pl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/merge.pl b/merge.pl
index 39844e3..40ba3d8 100755
--- a/merge.pl
+++ b/merge.pl
@@ -97,13 +97,15 @@ while (my $cols = $csv->getline_hr($IN) ) {
 
   my $bcc = $tmplData->{'bcc'};
   my $cc  = $tmplData->{'cc'};
+  my $email_address = $cols->{'email'} || $cols->{'email_address'};
   if ($send) {
+
     # If we're sending email, then send it, optionally with a BCC.
-    print "Sending to $cols->{'email'}" .
+    print "Sending to $email_address" .
        ($bcc ? "\n  BCC " . (ref($bcc) eq 'ARRAY' ? join(", ", @{$bcc}) : $bcc) . " " : '') .
        ($cc  ? "\n  cC  " . (ref($cc) eq 'ARRAY' ? join(", ", @{$cc}) : $cc) . " " : '') . "\n";
 
-    my @emails = ( $cols->{'email'} );
+    my @emails = ( $email_address );
 
     my $mail = MIME::Entity->build(
        To      => \@emails,
@@ -118,7 +120,7 @@ while (my $cols = $csv->getline_hr($IN) ) {
     $mail->send('sendmail');
   } else {
     # Say who we want to send to.
-    print "Want to send to: $cols->{'email'}" .
+    print "Want to send to: $email_address" .
        (defined $bcc ? "\n  BCC " . (ref($bcc) eq 'ARRAY' ? join(", ", @{$bcc}) : $bcc) . " " : '') .
        (defined $cc  ? "\n  CC  " . (ref($cc) eq 'ARRAY' ? join(", ", @{$cc}) : $cc) . " " : '') . "\n";
   }
-- 
2.30.2