Files
sam-manage/resources/views/system/tenant-mail/index.blade.php
김보곤 a0ba7fc13f feat: [email] 테넌트 이메일 설정 관리 기능 추가
- TenantMailConfigController: 목록, 편집, 저장, SMTP 테스트 API
- TenantMailConfig, MailLog 모델 추가
- SmtpConnectionTester: SMTP 연결 테스트 서비스 (에러 코드, 트러블슈팅)
- TenantMailService: 테넌트 설정 기반 메일 발송 (쿼터, Fallback)
- config/mail-presets.php: Gmail/Naver/MS365 등 8개 SMTP 프리셋
- Blade 뷰: 테넌트 목록 현황 + 설정 폼 (프리셋 자동 채움, 연결 테스트)
- 라우트 추가: /system/tenant-mail/*
2026-03-12 07:42:17 +09:00

133 lines
5.7 KiB
PHP

@extends('layouts.app')
@section('title', '테넌트 이메일 설정')
@push('styles')
<style>
.mail-status-badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.mail-status-green { background: #dcfce7; color: #16a34a; }
.mail-status-yellow { background: #fef9c3; color: #ca8a04; }
.mail-status-red { background: #fee2e2; color: #dc2626; }
.mail-status-gray { background: #f3f4f6; color: #6b7280; }
.provider-badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.provider-platform { background: #e0e7ff; color: #4338ca; }
.provider-smtp { background: #fef3c7; color: #d97706; }
.provider-none { background: #f3f4f6; color: #9ca3af; }
</style>
@endpush
@section('content')
<div class="space-y-6">
<!-- 페이지 헤더 -->
<div class="flex justify-between items-center">
<div>
<h1 class="text-2xl font-bold text-gray-800">테넌트 이메일 설정</h1>
<p class="text-sm text-gray-500 mt-1"> 테넌트의 메일 발송 설정을 관리합니다</p>
</div>
</div>
<!-- 테넌트 목록 -->
<div class="bg-white rounded-xl shadow-sm overflow-hidden">
<table class="w-full text-sm">
<thead>
<tr class="bg-gray-50 border-b border-gray-200">
<th class="px-4 py-3 text-left font-medium text-gray-600">테넌트</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">발송 방식</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">프리셋</th>
<th class="px-4 py-3 text-left font-medium text-gray-600">발신 주소</th>
<th class="px-4 py-3 text-center font-medium text-gray-600">상태</th>
<th class="px-4 py-3 text-center font-medium text-gray-600">오늘 발송</th>
<th class="px-4 py-3 text-center font-medium text-gray-600">관리</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($tenants as $item)
<tr class="hover:bg-gray-50 transition-colors">
<td class="px-4 py-3">
<div class="font-medium text-gray-800">{{ $item->tenant->company_name }}</div>
<div class="text-xs text-gray-400">ID: {{ $item->tenant->id }}</div>
</td>
<td class="px-4 py-3">
@if($item->config)
<span class="provider-badge provider-{{ $item->config->provider }}">
{{ $item->config->getProviderLabel() }}
</span>
@else
<span class="provider-badge provider-none">미설정</span>
@endif
</td>
<td class="px-4 py-3 text-gray-600">
{{ $item->config?->getPresetLabel() ?? '-' }}
</td>
<td class="px-4 py-3 text-gray-600">
{{ $item->config?->from_address ?? '-' }}
</td>
<td class="px-4 py-3 text-center">
@if($item->config)
<span class="mail-status-badge mail-status-{{ $item->config->getStatusColor() }}">
{{ $item->config->getStatusLabel() }}
</span>
@else
<span class="mail-status-badge mail-status-gray">미설정</span>
@endif
</td>
<td class="px-4 py-3 text-center text-gray-600">
@if($item->config)
{{ $item->today_count }}/{{ $item->config->daily_limit }}
@else
-
@endif
</td>
<td class="px-4 py-3 text-center">
<a href="{{ route('system.tenant-mail.edit', $item->tenant->id) }}"
class="inline-flex items-center gap-1 px-3 py-1.5 text-sm text-blue-600 hover:text-blue-800 hover:bg-blue-50 rounded-lg transition">
<i class="ri-settings-3-line"></i>
설정
</a>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-8 text-center text-gray-400">
등록된 테넌트가 없습니다
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- 안내 -->
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 text-sm text-blue-700">
<div class="flex items-start gap-2">
<i class="ri-information-line text-lg mt-0.5"></i>
<div>
<p class="font-medium">메일 설정 안내</p>
<ul class="mt-1 space-y-1 text-blue-600">
<li>미설정 테넌트는 SAM 플랫폼 기본 SMTP로 메일이 발송됩니다.</li>
<li>"자체 SMTP" 설정 테넌트 회사 도메인으로 메일이 발송됩니다.</li>
<li>SMTP 설정 반드시 연결 테스트를 수행하세요.</li>
</ul>
</div>
</div>
</div>
</div>
@endsection