+
+ my $classnum = $opt{'to_contact_classnum'} || '';
+ my @classes = ref($classnum) ? @$classnum : split(',', $classnum);
+
+ # There are two e-mail opt-in flags per contact_email address.
+ # If neither 'invoice' nor 'message' has been specified, default
+ # to 'invoice'.
+ #
+ # This default supports the legacy behavior of
+ # send to all invoice recipients
+ push @classes,'invoice'
+ unless grep {$_ eq 'invoice' || $_ eq 'message'} @classes;
+
+ @to = $cust_main->contact_list_email(@classes);
+ # not guaranteed to produce contacts, but then customers aren't
+ # guaranteed to have email addresses on file. in that case, env_to
+ # will be null and sending this message will fail.
+