libra/docs/stories/story-8.1-email-infrastruct...

77 lines
2.0 KiB
Markdown

# Story 8.1: Email Infrastructure Setup
## Epic Reference
**Epic 8:** Email Notification System
## User Story
As a **developer**,
I want **to configure email sending infrastructure and base templates**,
So that **all emails have consistent branding and reliable delivery**.
## Acceptance Criteria
### SMTP Configuration
- [ ] MAIL_MAILER configured via .env
- [ ] MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD
- [ ] MAIL_ENCRYPTION (TLS)
- [ ] MAIL_FROM_ADDRESS: no-reply@libra.ps
- [ ] MAIL_FROM_NAME: Libra Law Firm / مكتب ليبرا للمحاماة
### Base Email Template
- [ ] Libra logo in header
- [ ] Navy blue (#0A1F44) and gold (#D4AF37) colors
- [ ] Professional typography
- [ ] Footer with firm contact info
- [ ] Mobile-responsive layout
### Technical Setup
- [ ] Plain text fallback generation
- [ ] Queue configuration for async sending
- [ ] Email logging for debugging
## Technical Notes
```php
// config/mail.php - from .env
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'no-reply@libra.ps'),
'name' => env('MAIL_FROM_NAME', 'Libra Law Firm'),
],
// resources/views/vendor/mail/html/header.blade.php
<tr>
<td class="header" style="background-color: #0A1F44; padding: 25px;">
<a href="{{ config('app.url') }}">
<img src="{{ asset('images/logo-email.png') }}" alt="Libra Law Firm" height="45">
</a>
</td>
</tr>
// Base Mailable
abstract class BaseMailable extends Mailable
{
use Queueable, SerializesModels;
public function build()
{
return $this->from(config('mail.from.address'), $this->getFromName());
}
protected function getFromName(): string
{
$locale = $this->getLocale();
return $locale === 'ar' ? 'مكتب ليبرا للمحاماة' : 'Libra Law Firm';
}
}
```
## Definition of Done
- [ ] SMTP sending works
- [ ] Base template with branding
- [ ] Plain text fallback
- [ ] Queued delivery works
- [ ] Tests pass
## Estimation
**Complexity:** Medium | **Effort:** 3-4 hours