feat: allow specifying sender address in email provider settings

This commit is contained in:
Oleh Astappiev
2025-05-19 13:13:23 -06:00
committed by Aditya Chandel
parent b73fb2be5c
commit 4fdd612dc3
10 changed files with 27 additions and 6 deletions
@@ -41,7 +41,7 @@ export class BookSenderComponent implements OnInit {
this.emailProviderService.getEmailProviders().subscribe({
next: (emailProviders: EmailProvider[]) => {
this.emailProviders = emailProviders.map(provider => ({
label: `${provider.name} | ${provider.host}`,
label: `${provider.name} | ${provider.fromAddress || provider.host}`,
value: provider
}));
}
@@ -44,6 +44,11 @@
<p-checkbox formControlName="startTls" [binary]="true"></p-checkbox>
</div>
<div class="flex items-center gap-4">
<label class="w-40 text-right font-medium">From Address:</label>
<input type="text" pInputText formControlName="fromAddress" placeholder="Enter from address... " class="w-full md:w-80"/>
</div>
<div class="flex justify-end">
<p-button label="Create Email Provider" [disabled]="emailProviderForm.invalid" type="submit">
</p-button>
@@ -35,6 +35,7 @@ export class CreateEmailProviderDialogComponent implements OnInit {
port: [null, [Validators.required, Validators.min(1)]],
username: [''],
password: [''],
fromAddress: ['', [Validators.email]],
auth: [false],
startTls: [false]
});
@@ -13,14 +13,15 @@
<ng-template pTemplate="header">
<tr>
<th style="width: 5%;">Default</th>
<th style="width: 15%;">Name</th>
<th style="width: 10%;">Name</th>
<th style="width: 15%;">Host</th>
<th style="width: 10%;">Port</th>
<th style="width: 6%;">Port</th>
<th style="width: 15%;">Username</th>
<th style="width: 15%;">Password</th>
<th style="width: 5%;">Auth</th>
<th style="width: 4%;">Auth</th>
<th style="width: 5%;">StartTLS</th>
<th style="width: 10%;">Edit</th>
<th style="width: 12%;">From Address</th>
<th style="width: 8%;">Edit</th>
<th style="width: 10%;">Delete</th>
</tr>
</ng-template>
@@ -77,6 +78,11 @@
</p-checkbox>
</td>
<td>
<input *ngIf="provider.isEditing" type="text" [(ngModel)]="provider.fromAddress" class="p-inputtext w-full"/>
<span *ngIf="!provider.isEditing">{{ provider.fromAddress }}</span>
</td>
<td class="text-center">
<p-button *ngIf="!provider.isEditing" icon="pi pi-pencil" outlined="true" severity="info" (onClick)="toggleEdit(provider)"></p-button>
<p-button *ngIf="provider.isEditing" icon="pi pi-check" outlined="true" severity="success" (onClick)="saveProvider(provider)"></p-button>
@@ -6,6 +6,7 @@ export interface EmailProvider {
port: number;
username: string;
password: string;
fromAddress: string;
auth: boolean;
startTls: boolean;
defaultProvider: boolean;