feat: Send actual test email instead of just verifying connection

- testConnection now sends a real test email to the configured Gmail address
- User receives actual email confirmation that setup works
- Email contains success message and system info
This commit is contained in:
salvacybersec
2025-11-10 19:31:42 +03:00
parent c9ff811cc1
commit dea1b874b5

View File

@@ -85,7 +85,18 @@ class MailService {
async testConnection() { async testConnection() {
try { try {
await this.initializeTransporter(); await this.initializeTransporter();
return { success: true, message: 'Gmail connection successful' };
// Send actual test email
const testEmail = await this.sendMail(
this.transporter.options.auth.user, // Send to self
'Test Mail - Oltalama Paneli',
'<h2>✅ Test Başarılı!</h2><p>Gmail ayarlarınız doğru yapılandırılmış ve mail gönderimi çalışıyor.</p><p><strong>Sistem:</strong> Oltalama Test Yönetim Paneli</p>'
);
return {
success: true,
message: `Test maili başarıyla gönderildi! (${testEmail.messageId})`
};
} catch (error) { } catch (error) {
return { success: false, error: error.message }; return { success: false, error: error.message };
} }