add: tests
This commit is contained in:
parent
eebf859afa
commit
ce7f620984
16 changed files with 681 additions and 152 deletions
34
app/Http/Controllers/ThirdPartyServices/EmailService.php
Normal file
34
app/Http/Controllers/ThirdPartyServices/EmailService.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ThirdPartyServices;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\sendExportNotice;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use RuntimeException;
|
||||
|
||||
class EmailService extends Controller
|
||||
{
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->email_address_recepient = env('EMAIL_ADDRESS_RECEPIENT', null);
|
||||
$this->email_prefix_subject = env('EMAIL_PREFIX_SUBJECT', null);
|
||||
$this->nextcloud_upload_folder_web_link = env('NEXTCLOUD_UPLOAD_FOLDER_WEB_LINK', false);
|
||||
}
|
||||
function send_export_via_email(string $from_date, string $to_date, string $file_name){
|
||||
try{
|
||||
$email_subject = $this->email_prefix_subject . ' '. $from_date.' - '.$to_date;
|
||||
Mail::to($this->email_address_recepient)->send(new sendExportNotice(['export_date' => $email_subject, 'file_name' => $file_name, 'upload_folder_web_link' => $this->nextcloud_upload_folder_web_link], $email_subject));
|
||||
return true;
|
||||
}catch (\Exception $e) {
|
||||
Log::error('send_export_via_email Email error - ' . $e->getMessage());
|
||||
//throw new RuntimeException("E-EMAIL");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue