Unified email reports
This commit is contained in:
27
index.php
Executable file → Normal file
27
index.php
Executable file → Normal file
@@ -41,7 +41,7 @@ if($result > 0){
|
||||
|
||||
}
|
||||
|
||||
$report_link = "https://www.crewsportswear.com/email_reports/daily_reports_with_image.php?d=". $dateToday;
|
||||
$report_link = (getenv('APP_URL') ?: 'https://www.crewsportswear.com') . "/email_reports/daily_reports_with_image.php?d=". $dateToday;
|
||||
$body = "<html>";
|
||||
$body .= "<body>";
|
||||
$body .= "<p> Please download the attached file for today's order report.</p>";
|
||||
@@ -52,7 +52,8 @@ if($result > 0){
|
||||
|
||||
foreach($invoice_array as $invoice){
|
||||
$v = explode("|", $invoice);
|
||||
$body .= "<div>Invoice Number: <a href='http://admin.crewsportswear.com:23000/admin/orders/view/" . $v['0']."/print'>" . $v['1'] . "</a></div>";
|
||||
$admin_url = getenv('ADMIN_URL') ?: 'https://admin.crewsportswear.app';
|
||||
$body .= "<div>Invoice Number: <a href='" . $admin_url . "/admin/orders/view/" . $v['0']."/print'>" . $v['1'] . "</a></div>";
|
||||
}
|
||||
|
||||
$body .= "</body>";
|
||||
@@ -64,19 +65,23 @@ if($result > 0){
|
||||
// $mail->SMTPDebug = 3; // uncomment for debug mode.
|
||||
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Host = "smtp.gmail.com";
|
||||
$mail->Port = "587";
|
||||
$mail->Host = getenv('SMTP_HOST') ?: 'smtp.gmail.com';
|
||||
$mail->Port = getenv('SMTP_PORT') ?: '587';
|
||||
|
||||
//gmail account
|
||||
$mail->Username = 'no-reply@crewsportswear.com';
|
||||
$mail->Password = '20HustleHard19!';
|
||||
//gmail account credentials from environment
|
||||
$mail->Username = getenv('SMTP_USER') ?: 'mail@crewsportswear.com';
|
||||
$mail->Password = getenv('SMTP_PASS') ?: 'tjpwykpttvkjilxh';
|
||||
|
||||
$mail->SetFrom('orders@crewsportswear.com', 'CREW Daily Order Report');
|
||||
|
||||
$mail->addAddress('graphics@crewsportswear.com');
|
||||
$mail->addBCC("webmaster@crewsportswear.com");
|
||||
$mail->addBCC("angelo@crewsportswear.com");
|
||||
$mail->addBCC("production@crewsportswear.com");
|
||||
// Recipients from environment or defaults
|
||||
$email_to = getenv('EMAIL_TO') ?: 'graphics@crewsportswear.com';
|
||||
$mail->addAddress($email_to);
|
||||
|
||||
$email_bcc = getenv('EMAIL_BCC') ?: 'webmaster@crewsportswear.com,angelo@crewsportswear.com,production@crewsportswear.com';
|
||||
foreach (explode(',', $email_bcc) as $bcc_email) {
|
||||
$mail->addBCC(trim($bcc_email));
|
||||
}
|
||||
|
||||
$mail->addAttachment('daily_order_reports/'.$filename);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user