diff --git a/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.ts b/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.ts index 2514390c9..8cd62c76d 100644 --- a/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.ts @@ -62,8 +62,12 @@ export class SmtpFormComponent extends BaseFormComponent implements OnInit { async testConnection() { this._loadingService.start(); try { - await firstValueFrom(this._smtpConfigService.testSMTPConfiguration(this.form.getRawValue())); - this._toaster.success(_('general-config-screen.test.success')); + const response = await firstValueFrom(this._smtpConfigService.testSMTPConfiguration(this.form.getRawValue())); + if (!response.adminEmail) { + this._toaster.warning(_('general-config-screen.test.warning'), { params: { recipientEmail: response.recipientEmail } }); + } else { + this._toaster.success(_('general-config-screen.test.success')); + } } catch (e) { this._toaster.error(_('general-config-screen.test.error')); } finally { diff --git a/apps/red-ui/src/app/modules/admin/services/smtp-config.service.ts b/apps/red-ui/src/app/modules/admin/services/smtp-config.service.ts index 40b949acd..fcca71a0a 100644 --- a/apps/red-ui/src/app/modules/admin/services/smtp-config.service.ts +++ b/apps/red-ui/src/app/modules/admin/services/smtp-config.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { GenericService } from '@iqser/common-ui'; -import { ISmtpConfiguration } from '@red/domain'; +import { ISmtpConfiguration, ITextConnectionResponse } from '@red/domain'; @Injectable() export class SmtpConfigService extends GenericService { @@ -12,7 +12,7 @@ export class SmtpConfigService extends GenericService { } testSMTPConfiguration(body: ISmtpConfiguration) { - return this._post(body, `${this._defaultModelPath}/smtp/test`); + return this._post(body, `${this._defaultModelPath}/smtp/test`); } getCurrentSMTPConfiguration() { diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 277f0a88a..e8d7e372e 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -1642,7 +1642,8 @@ }, "test": { "error": "Die Test-E-Mail konnte nicht gesendet werden! Bitte überprüfen Sie die E-Mail-Adresse.", - "success": "Die Test-E-Mail wurde erfolgreich versendet!" + "success": "Die Test-E-Mail wurde erfolgreich versendet!", + "warning": "" }, "title": "SMTP-Konto konfigurieren" }, @@ -2505,4 +2506,4 @@ } }, "yesterday": "Gestern" -} \ No newline at end of file +} diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 31326cfda..c99984b31 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1642,7 +1642,8 @@ }, "test": { "error": "Test e-mail could not be sent. Please double-check the email address.", - "success": "Test e-mail was sent successfully!" + "success": "Test e-mail was sent successfully!", + "warning": "Admin mail address not set. Test email sent to {recipientEmail} instead." }, "title": "Configure SMTP account" }, @@ -2505,4 +2506,4 @@ } }, "yesterday": "Yesterday" -} \ No newline at end of file +} diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index 41881e6b1..5e85c036c 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -1642,7 +1642,8 @@ }, "test": { "error": "Die Test-E-Mail konnte nicht gesendet werden! Bitte überprüfen Sie die E-Mail-Adresse.", - "success": "Die Test-E-Mail wurde erfolgreich versendet!" + "success": "Die Test-E-Mail wurde erfolgreich versendet!", + "warning": "" }, "title": "SMTP-Konto konfigurieren" }, @@ -2505,4 +2506,4 @@ } }, "yesterday": "Gestern" -} \ No newline at end of file +} diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index c025c4606..a63feea13 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -1642,7 +1642,8 @@ }, "test": { "error": "Test e-mail could not be sent! Please revise the e-mail address.", - "success": "Test e-mail was sent successfully!" + "success": "Test e-mail was sent successfully!", + "warning": "Admin mail address not set. Test email sent to {recipientEmail} instead." }, "title": "Configure SMTP Account" }, @@ -2505,4 +2506,4 @@ } }, "yesterday": "Yesterday" -} \ No newline at end of file +} diff --git a/libs/red-domain/src/lib/configuration/smtp-configuration.ts b/libs/red-domain/src/lib/configuration/smtp-configuration.ts index 4095e55f5..88226f110 100644 --- a/libs/red-domain/src/lib/configuration/smtp-configuration.ts +++ b/libs/red-domain/src/lib/configuration/smtp-configuration.ts @@ -13,3 +13,10 @@ export interface ISmtpConfiguration { starttls?: boolean; user?: string; } + +export interface ITextConnectionResponse { + adminEmail: boolean; + reasonPhrase: string; + recipientEmail: string; + statusCode: number; +}