Laravel Vapor - test attaching a file in an email + upload file to S3 (code sync from shipping portal)

This commit is contained in:
Dillon Ngo
2024-05-25 01:17:25 +08:00
parent 67fc0bbf99
commit 94189da10d
@@ -68,25 +68,23 @@ class TestAttachingS3FileAndSendEmailV2CommandJob implements ShouldQueue
$zip->close();
//STEP 2: Upload the zip file to S3
$filePathForS3 = 'temp/'.$zip_file;
Storage::disk('s3')->put($filePathForS3, file_get_contents($attachment));
// $filePathForS3 = 'temp/'.$zip_file;
// Storage::disk('s3')->put($filePathForS3, file_get_contents($attachment));
Log::info('DownloadBookingDocumentLogic finished processing files to zip count: '.count($bookings));
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
$filePathForS3,
Carbon::now()->addMinutes(10)
);
Log::info("[TESTING] total bookings: $temporaryUrl");
// Log::info('DownloadBookingDocumentLogic finished processing files to zip count: '.count($bookings));
// $temporaryUrl = Storage::disk('s3')->temporaryUrl(
// $filePathForS3,
// Carbon::now()->addMinutes(10)
// );
// Log::info("[TESTING] total bookings: $temporaryUrl");
//STEP 3: Send Email
// Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION ".$startDate->format('d-m-Y')." - ".$endDate->format('d-m-Y').".\r\n\r\n**This is an automatically generated email please do not reply to it. If you have any queries kindly contact our admin team through Wechat.\r\n\r\n\r\nCIEF WORLDWIDE SDN BHD", function($message) use ($attachment, $startDate, $endDate){
// $message->from('exchange@cief-malaysia.com');
// $message->to(['vtnation16@gmail.com', 'vtnation@gmail.com', 'atvantic04@gmail.com', 'vtnation2@gmail.com']);
// $message->cc(['shafiqa_sukeri@cief-malaysia.com', 'frontendcief@gmail.com', 'pm@cief-malaysia.com', 'hasan@cief-malaysia.com', 'shipping_admin@cief-malaysia.com', 'hasanakbar27@gmail.com', 'pmwong2019@gmail.com', 'uldvstar@gmail.com']);
// $message->subject('CIEF DO COMPILATION '.$startDate->format('d-m-Y').' - '.$endDate->format('d-m-Y'));
// $message->attach($attachment);
// });
Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION ".$startDate->format('d-m-Y')." - ".$endDate->format('d-m-Y').".\r\n\r\n**This is an automatically generated email please do not reply to it. If you have any queries kindly contact our admin team through Wechat.\r\n\r\n\r\nCIEF WORLDWIDE SDN BHD", function($message) use ($attachment, $startDate, $endDate){
$message->from('exchange@cief-malaysia.com');
$message->to(['dillonngoweijoon@gmail.com']);
$message->subject('CIEF DO COMPILATION '.$startDate->format('d-m-Y').' - '.$endDate->format('d-m-Y'));
$message->attach($attachment);
});
File::delete($attachment);
Log::info('success');