Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

- name: Run Laravel Pint
uses: aglipanci/laravel-pint-action@latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
87 changes: 87 additions & 0 deletions database/factories/MailLogFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

namespace Eclipse\Core\Database\Factories;

use Eclipse\Core\Models\MailLog;
use Eclipse\Core\Models\Site;
use Eclipse\Core\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<MailLog>
*/
class MailLogFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
*/
protected $model = MailLog::class;

/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'site_id' => Site::inRandomOrder()->first()?->id ?? Site::factory()->create()->id,
'message_id' => fake()->uuid(),
'from' => fake()->email(),
'to' => fake()->email(),
'cc' => null,
'bcc' => null,
'subject' => fake()->sentence(),
'body' => '<p>'.fake()->paragraph().'</p>',
'headers' => [
'Content-Type' => 'text/html; charset=UTF-8',
'X-Mailer' => 'Laravel',
],
'attachments' => [],
'sender_id' => User::inRandomOrder()->first()?->id ?? User::factory()->create()->id,
'recipient_id' => null,
'status' => fake()->randomElement(['sent', 'sending', 'failed']),
'sent_at' => fake()->dateTimeBetween('-1 month', 'now'),
'data' => [],
'opened' => null,
'delivered' => null,
'complaint' => null,
'bounced' => null,
];
}

/**
* Indicate that the mail log is sent.
*/
public function sent(): static
{
return $this->state(fn (array $attributes) => [
'status' => 'sent',
'sent_at' => now(),
]);
}

/**
* Indicate that the mail log is sending.
*/
public function sending(): static
{
return $this->state(fn (array $attributes) => [
'status' => 'sending',
'sent_at' => null,
]);
}

/**
* Indicate that the mail log failed.
*/
public function failed(): static
{
return $this->state(fn (array $attributes) => [
'status' => 'failed',
'sent_at' => null,
]);
}
}
53 changes: 53 additions & 0 deletions database/migrations/2025_07_25_183516_create_mail_logs_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('mail_logs', function (Blueprint $table) {
$table->increments('id');

$table->foreignId('site_id')->nullable()->constrained('sites')->onDelete('cascade');

$table->string('from')->nullable();
$table->string('to')->nullable();
$table->string('cc')->nullable();
$table->string('bcc')->nullable();
$table->string('subject');
$table->text('body');
$table->text('headers')->nullable();
$table->longText('attachments')->nullable();
$table->uuid('message_id')->nullable();
$table->string('status')->nullable();
$table->longText('data')->nullable();
$table->timestamp('opened')->nullable();
$table->timestamp('delivered')->nullable();
$table->timestamp('complaint')->nullable();
$table->timestamp('bounced')->nullable();

$table->foreignId('sender_id')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('recipient_id')->nullable()->constrained('users')->onDelete('set null');

$table->timestamps();

$table->index('message_id');
$table->index('status');
$table->index(['site_id', 'created_at']);
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('mail_logs');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('mail_logs', function (Blueprint $table) {
$table->timestamp('sent_at')->nullable()->after('status');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('mail_logs', function (Blueprint $table) {
$table->dropColumn('sent_at');
});
}
};
59 changes: 59 additions & 0 deletions resources/lang/en/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

return [
'send_email' => 'Send Email',
'send_email_to' => 'Send Email to :name',
'sender' => 'Sender',
'recipient' => 'Recipient',
'cc' => 'CC',
'cc_help' => 'Additional recipients',
'bcc' => 'BCC',
'bcc_help' => 'Hidden recipients',
'subject' => 'Subject',
'subject_placeholder' => 'Enter email subject',
'message' => 'Message',
'message_placeholder' => 'Enter message content...',
'send' => 'Send',
'cancel' => 'Cancel',
'email_queued' => 'Email queued',
'email_queued_to' => 'Email to :email has been queued for sending.',
'email_sent' => 'Email sent',
'email_sent_to' => 'Email to :email has been successfully sent.',
'permission_denied' => 'Permission denied',
'permission_denied_message' => 'You do not have permission to send emails.',
'error' => 'Error',
'send_error_message' => 'An error occurred while sending the email: :error',
'email_form_title' => 'Send Email',
'email_form_description' => 'Send an email to the selected user',
'your_email' => 'Your email address',
'recipient_email' => 'Recipient email address',
'invalid_cc_email' => 'One or more CC email addresses are invalid.',
'invalid_bcc_email' => 'One or more BCC email addresses are invalid.',

// Mail Log / Outbox
'outbox' => 'Email Outbox',
'outbox_description' => 'View all outgoing emails',
'email_details' => 'Email Details',
'email_body' => 'Email Body',
'metadata' => 'Metadata',
'user_information' => 'User Information',
'headers' => 'Headers',
'from' => 'From',
'to' => 'To',
'sent_at' => 'Sent At',
'message_id' => 'Message ID',
'status' => 'Status',
'sent' => 'Sent',
'sending' => 'Sending',
'failed' => 'Failed',
'sent_today' => 'Sent Today',
'sent_this_week' => 'Sent This Week',
'back_to_outbox' => 'Back to Outbox',
'view_email' => 'View Email',
'no_emails' => 'No emails found',
'email_log' => 'Email Log',
'show_html' => 'Show HTML',
'show_preview' => 'Show Preview',
'email_preview' => 'Email Preview',
'html_source' => 'HTML Source',
];
59 changes: 59 additions & 0 deletions resources/lang/hr/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

return [
'send_email' => 'Pošaljite e-mail',
'send_email_to' => 'Pošaljite e-mail korisniku :name',
'sender' => 'Pošaljitelj',
'recipient' => 'Primatelj',
'cc' => 'CC',
'cc_help' => 'Dodatni primatelji',
'bcc' => 'BCC',
'bcc_help' => 'Skriveni primatelji',
'subject' => 'Predmet',
'subject_placeholder' => 'Unesite predmet e-maila',
'message' => 'Poruka',
'message_placeholder' => 'Unesite sadržaj poruke...',
'send' => 'Pošaljite',
'cancel' => 'Otkaži',
'email_queued' => 'E-mail je u redu za slanje',
'email_queued_to' => 'E-mail za :email je dodan u red za slanje.',
'email_sent' => 'E-mail poslan',
'email_sent_to' => 'E-mail poslan na :email je uspješno poslan.',
'permission_denied' => 'Dozvola odbijena',
'permission_denied_message' => 'Nemate dozvolu za slanje e-mailova.',
'error' => 'Greška',
'send_error_message' => 'Došlo je do greške prilikom slanja e-maila: :error',
'email_form_title' => 'Pošaljite e-mail',
'email_form_description' => 'Pošaljite e-mail odabranom korisniku',
'your_email' => 'Vaša e-mail adresa',
'recipient_email' => 'E-mail adresa primatelja',
'invalid_cc_email' => 'Jedna ili više CC e-mail adresa nije valjana.',
'invalid_bcc_email' => 'Jedna ili više BCC e-mail adresa nije valjana.',

// Mail Log / Outbox
'outbox' => 'Odlazni e-mailovi',
'outbox_description' => 'Pregled svih odlaznih e-mailova',
'email_details' => 'Detalji e-maila',
'email_body' => 'Sadržaj e-maila',
'metadata' => 'Metapodaci',
'user_information' => 'Informacije o korisnicima',
'headers' => 'Zaglavlja',
'from' => 'Od',
'to' => 'Za',
'sent_at' => 'Poslano u',
'message_id' => 'ID poruke',
'status' => 'Status',
'sent' => 'Poslano',
'sending' => 'Šalje se',
'failed' => 'Neuspješno',
'sent_today' => 'Poslano danas',
'sent_this_week' => 'Poslano ovaj tjedan',
'back_to_outbox' => 'Natrag na odlazne poruke',
'view_email' => 'Prikaži e-mail',
'no_emails' => 'Nema pronađenih e-mailova',
'email_log' => 'Dnevnik e-mailova',
'show_html' => 'Prikaži HTML',
'show_preview' => 'Prikaži pregled',
'email_preview' => 'Pregled e-maila',
'html_source' => 'HTML kod',
];
59 changes: 59 additions & 0 deletions resources/lang/sl/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

return [
'send_email' => 'Pošlji e-pošto',
'send_email_to' => 'Pošlji e-pošto uporabniku :name',
'sender' => 'Pošiljatelj',
'recipient' => 'Prejemnik',
'cc' => 'Kp (CC)',
'cc_help' => 'Dodatni prejemniki',
'bcc' => 'Skp (BCC)',
'bcc_help' => 'Skriti prejemniki',
'subject' => 'Zadeva',
'subject_placeholder' => 'Vnesite zadevo sporočila',
'message' => 'Sporočilo',
'message_placeholder' => 'Vnesite vsebino sporočila...',
'send' => 'Pošlji',
'cancel' => 'Prekliči',
'email_queued' => 'E-pošta v čakalni vrsti',
'email_queued_to' => 'E-pošta za :email je dodana v čakalno vrsto za pošiljanje.',
'email_sent' => 'E-pošta poslana',
'email_sent_to' => 'E-pošta je bila uspešno poslana na :email.',
'permission_denied' => 'Dostop zavrnjen',
'permission_denied_message' => 'Nimate dovoljenja za pošiljanje e-pošte.',
'error' => 'Napaka',
'send_error_message' => 'Prišlo je do napake pri pošiljanju e-pošte: :error',
'email_form_title' => 'Pošiljanje e-pošte',
'email_form_description' => 'Pošljite e-pošto izbranemu uporabniku',
'your_email' => 'Vaš e-poštni naslov',
'recipient_email' => 'Prejemnik e-pošte',
'invalid_cc_email' => 'En ali več CC e-poštnih naslovov ni veljavnih.',
'invalid_bcc_email' => 'En ali več BCC e-poštnih naslovov ni veljavnih.',

// Mail Log / Outbox
'outbox' => 'Odhodna e-pošta',
'outbox_description' => 'Pregled vse odhodne e-pošte',
'email_details' => 'Podrobnosti e-pošte',
'email_body' => 'Vsebina e-pošte',
'metadata' => 'Metapodatki',
'user_information' => 'Podatki o uporabnikih',
'headers' => 'Glave',
'from' => 'Od',
'to' => 'Za',
'sent_at' => 'Poslano ob',
'message_id' => 'ID sporočila',
'status' => 'Status',
'sent' => 'Poslano',
'sending' => 'Pošiljanje',
'failed' => 'Neuspešno',
'sent_today' => 'Poslano danes',
'sent_this_week' => 'Poslano ta teden',
'back_to_outbox' => 'Nazaj na odhodna sporočila',
'view_email' => 'Prikaži e-pošto',
'no_emails' => 'Ni najdenih e-poštnih sporočil',
'email_log' => 'Dnevnik e-pošte',
'show_html' => 'Prikaži HTML',
'show_preview' => 'Prikaži predogled',
'email_preview' => 'Predogled e-pošte',
'html_source' => 'HTML koda',
];
Loading