$msg .= "Checkins Lifetime successful\n"; } else { $contents_checkins_lifetime .= "no checkins Lifetime,"; $msg .= "Checkins Today Lifetime (No Results)\n"; } error_log("message" . $msg, 0); $email = new Mail_Postmark(); $email->addTo($output_mail, 'Grind Tech Output'); $email->addCc($destination_mail); $email->subject('Daily Reports'); $email->messagePlain('Attached are the Daily Grind Reports' . "\n" . "User report:\n" . 'https://members.grindspaces.com/reports/' . $filename1 . "\nLifetime check-ins report:\n" . 'https://members.grindspaces.com/reports/' . $filename3); file_put_contents('/var/www/vhosts/members.grindspaces.com/content/reports/' . $filename1, $contents_users); file_put_contents('/var/www/vhosts/members.grindspaces.com/content/reports/' . $filename3, $contents_checkins_lifetime); //$email->addCustomAttachment($filename1, $contents_users, $mimeType1); echo "Total Size " . strlen($content_users . $contents_checkins . $contents_checkins_lifetime); $email->addCustomAttachment($filename2, $contents_checkins, $mimeType2); //$email->addCustomAttachment($filename3, $contents_checkins_lifetime, $mimeType3); $email->debug($debug); $email->send(); } catch (Exception $e) { $msg .= 'Error occurred: Reason: ' + $e->getMessage() . '<br/>'; error_log('Daily Reporting: Failed. Reason: ' . $e->getMessage(), 0); return false; } // end try catch if ($msg) { echo "\n**************************\n"; echo "REPORTING RESULTS\n"; echo $msg; echo "\n**************************\n"; }