diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index b92322a452..24593d96d5 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -455,6 +455,19 @@ if (!function_exists('fax_split_dtmf')) { $template_subcategory = 'inbound'; } + //create a new variable for the full file path and name + if (!empty($pdf_file) && file_exists($pdf_file)) { + $attachment_file = $pdf_file; + } + else { + $attachment_file = $fax_file; + } + + //send a link if the file is larger than 10 Megabytes + if (filesize($attachment_file) > 10 * 1024 * 1024) { + $fax_email_file = 'link'; + } + //get the email template from the database if (!empty($domain_uuid)) { $sql = "select template_subject, template_body from v_email_templates "; @@ -510,12 +523,11 @@ if (!function_exists('fax_split_dtmf')) { $email_attachments[0]['type'] = 'file'; if (!empty($pdf_file) && file_exists($pdf_file)) { $email_attachments[0]['name'] = $fax_file_name.'.pdf'; - $email_attachments[0]['value'] = $pdf_file; } else { $email_attachments[0]['name'] = $fax_file_name.'.tif'; - $email_attachments[0]['value'] = $fax_file; } + $email_attachments[0]['value'] = $attachment_file; } //send the email