+ if ($::form->{type} eq 'invoice' && (!$email || $::instance_conf->get_invoice_mail_settings ne 'cp')) {
+ # check for invoice_mail if defined (vc.invoice_email)
+ $inv_email = SL::DB::Customer->load_cached($::form->{vc_id})->invoice_mail;
+ if ($inv_email) {
+ # check if cc for contact is also wanted
+ $email_cc = $email if ($::instance_conf->get_invoice_mail_settings eq 'invoice_mail_cc_cp');
+ $email = $inv_email;
+ }
+ }
+ # still no email? use general mail (vc.email)