|
|
|
@ -25,6 +25,7 @@ import { AdminService } from '@core/http/admin.service'; |
|
|
|
import { ActionNotificationShow } from '@core/notification/notification.actions'; |
|
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
import { HasConfirmForm } from '@core/guards/confirm-on-exit.guard'; |
|
|
|
import { isString } from '@core/utils'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'tb-mail-server', |
|
|
|
@ -52,7 +53,11 @@ export class MailServerComponent extends PageComponent implements OnInit, HasCon |
|
|
|
this.adminService.getAdminSettings<MailServerSettings>('mail').subscribe( |
|
|
|
(adminSettings) => { |
|
|
|
this.adminSettings = adminSettings; |
|
|
|
if (this.adminSettings.jsonValue && isString(this.adminSettings.jsonValue.enableTls)) { |
|
|
|
this.adminSettings.jsonValue.enableTls = (this.adminSettings.jsonValue.enableTls as any) === 'true'; |
|
|
|
} |
|
|
|
this.mailSettings.reset(this.adminSettings.jsonValue); |
|
|
|
this.enableProxyChanged(); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
@ -68,13 +73,33 @@ export class MailServerComponent extends PageComponent implements OnInit, HasCon |
|
|
|
timeout: ['10000', [Validators.required, |
|
|
|
Validators.pattern(/^[0-9]{1,6}$/), |
|
|
|
Validators.maxLength(6)]], |
|
|
|
enableTls: ['false'], |
|
|
|
enableTls: [false], |
|
|
|
tlsVersion: [], |
|
|
|
enableProxy: [false, []], |
|
|
|
proxyHost: ['', [Validators.required]], |
|
|
|
proxyPort: ['', [Validators.required, Validators.min(1), Validators.max(65535)]], |
|
|
|
proxyUser: [''], |
|
|
|
proxyPassword: [''], |
|
|
|
username: [''], |
|
|
|
password: [''] |
|
|
|
}); |
|
|
|
this.registerDisableOnLoadFormControl(this.mailSettings.get('smtpProtocol')); |
|
|
|
this.registerDisableOnLoadFormControl(this.mailSettings.get('enableTls')); |
|
|
|
this.registerDisableOnLoadFormControl(this.mailSettings.get('enableProxy')); |
|
|
|
this.mailSettings.get('enableProxy').valueChanges.subscribe(() => { |
|
|
|
this.enableProxyChanged(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
enableProxyChanged(): void { |
|
|
|
let enableProxy: boolean = this.mailSettings.get('enableProxy').value; |
|
|
|
if (enableProxy) { |
|
|
|
this.mailSettings.get('proxyHost').enable(); |
|
|
|
this.mailSettings.get('proxyPort').enable(); |
|
|
|
} else { |
|
|
|
this.mailSettings.get('proxyHost').disable(); |
|
|
|
this.mailSettings.get('proxyPort').disable(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
sendTestMail(): void { |
|
|
|
|