feat: Update email testing to use form values without saving
- Update sendTestEmail method to use new /api/v1/settings/test-email endpoint - Send current form values directly to test endpoint without saving to DB - Format request body according to backend requirements
This commit is contained in:
1 parent
69bcd07c01
commit
8ef45a7fb9
1 file changed
+19
-2
@@ -1154,10 +1154,27 @@ class NetworkService {
|
||||
}
|
||||
|
||||
// ************************************
|
||||
// Send tes t email
|
||||
// Send test email
|
||||
// ************************************
|
||||
async sendTestEmail(config) {
|
||||
const { to } = config;
|
||||
// Extract recipient and email configuration
|
||||
const { to, emailConfig } = config;
|
||||
|
||||
// If emailConfig is provided, use the new endpoint with direct parameters
|
||||
if (emailConfig) {
|
||||
return this.axiosInstance.post(`/api/v1/settings/test-email`, {
|
||||
to,
|
||||
systemEmailHost: emailConfig.systemEmailHost,
|
||||
systemEmailPort: emailConfig.systemEmailPort,
|
||||
systemEmailAddress: emailConfig.systemEmailAddress,
|
||||
systemEmailPassword: emailConfig.systemEmailPassword,
|
||||
// Only include these if they are present
|
||||
...(emailConfig.systemEmailConnectionHost && { systemEmailConnectionHost: emailConfig.systemEmailConnectionHost }),
|
||||
...(emailConfig.systemEmailUser && { systemEmailUser: emailConfig.systemEmailUser })
|
||||
});
|
||||
}
|
||||
|
||||
// Fallback to original behavior for backward compatibility
|
||||
return this.axiosInstance.post(`/monitors/test-email`, { to });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user