Add missing variable for SES configuration

This commit is contained in:
David Bomba 2025-09-02 06:37:48 +10:00
parent 03c4f62b6e
commit 8da6374264
7 changed files with 33 additions and 2 deletions

View File

@ -534,8 +534,10 @@ class CompanySettings extends BaseSettings
public string $ses_access_key = '';
public string $ses_region = '';
public string $ses_topic_arn = '';
public string $ses_from_address = '';
public static $casts = [
'ses_from_address' => 'string',
'ses_topic_arn' => 'string',
'ses_secret_key' => 'string',
'ses_access_key' => 'string',

View File

@ -22,6 +22,7 @@ class BlackListRule implements ValidationRule
{
/** Bad domains +/- disposable email domains */
private array $blacklist = [
"freedrops.org",
"mailshan.com",
"tabletship.com",
"tiktook.lol",

View File

@ -122,7 +122,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property \App\Models\Client $client
* @property \App\Models\Vendor|null $vendor
* @property-read \App\Models\Location|null $location
* @property-read mixed $pivotcredi
* @property-read mixed $pivot
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents

View File

@ -121,6 +121,7 @@ class AppServiceProvider extends ServiceProvider
return $this;
});
Mail::extend('brevo', function () {
return (new BrevoTransportFactory())->create(
new Dsn(
@ -145,6 +146,30 @@ class AppServiceProvider extends ServiceProvider
return $this;
});
// Macro to configure SES with runtime credentials
Mailer::macro('ses_config', function (string $key, string $secret, string $region = 'us-east-1', ?string $topic_arn = null) {
$config = [
'key' => $key,
'secret' => $secret,
'region' => $region,
'version' => 'latest',
'service' => 'email',
];
$options = [];
if ($topic_arn) {
$options['ConfigurationSetName'] = $topic_arn;
}
$sesClient = new \Aws\Ses\SesClient($config);
$transport = new \Illuminate\Mail\Transport\SesTransport($sesClient, $options);
// @phpstan-ignore /** @phpstan-ignore-next-line **/
Mailer::setSymfonyTransport($transport);
return $this;
});
//Prevents destructive commands from being run in hosted environments
\DB::prohibitDestructiveCommands(Ninja::isHosted());

View File

@ -51,6 +51,7 @@ return [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],

View File

@ -257,7 +257,7 @@ return [
'storecove_email_catchall' => env('STORECOVE_CATCHALL_EMAIL',false),
'qvalia_api_key' => env('QVALIA_API_KEY', false),
'qvalia_partner_number' => env('QVALIA_PARTNER_NUMBER', false),
'pdf_page_numbering_x_alignment' => env('PDF_PAGE_NUMBER_X', -10),
'pdf_page_numbering_x_alignment' => env('PDF_PAGE_NUMBER_X', -5),
'pdf_page_numbering_y_alignment' => env('PDF_PAGE_NUMBER_Y', -6),
'hosted_einvoice_secret' => env('HOSTED_EINVOICE_SECRET', null),
'e_invoice_quota_warning' => env('E_INVOICE_QUOTA_WARNING', 15),

View File

@ -5629,6 +5629,8 @@ $lang = array(
'lang_Afrikaans' => 'Afrikaans',
'lang_Indonesian' => 'Indonesian',
'replaced' => 'Replaced',
'ses_from_address' => 'SES From Address',
'ses_from_address_help' => 'The Sending Email Address, must be verified in AWS',
);
return $lang;