]> git.etc.gen.nz Git - mail-merge.git/commitdiff
Make the email col configurable, and die if we can't find it
authorAndrew Ruthven <puck@catalystcloud.nz>
Mon, 27 Jun 2022 09:36:47 +0000 (21:36 +1200)
committerAndrew Ruthven <puck@catalyst.net.nz>
Mon, 27 Jun 2022 09:36:47 +0000 (21:36 +1200)
merge.pl

index 65695af3719b63827d06ebd2a9666eb09392658d..b2f518b84afc68aa5d1311e8c8084b071a8c724d 100755 (executable)
--- a/merge.pl
+++ b/merge.pl
@@ -203,6 +203,10 @@ sub merge_message {
   my $cc       = $tmplData->{'cc'};
   my $reply_to = $tmplData->{'reply_to'};
   my $email_address = $cols->{'email'} || $cols->{'email_address'};
+  if (! defined $email_address && defined $tmplData->{'email_col'}) {
+    $email_address = $cols->{$tmplData->{'email_col'}};
+  }
+  die "Unable to find email_address" unless defined $email_address;
   if ($send) {
 
     # If we're sending email, then send it, optionally with a BCC.