Skip to content

Commit

Permalink
feat: add multi email to cc when sending email
Browse files Browse the repository at this point in the history
  • Loading branch information
abelkhay committed Mar 25, 2024
1 parent c1d2f41 commit d1d39bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
</div>
</div>
<div class="col-md-auto col-12 text-md-end d-print-none" *ngIf="courriel || telephone">
<a *ngIf="courriel" href="mailto:{{ courriel }}" class="btn btn-sm btn-secondary mb-1" (click)="$event.stopPropagation()">
<a
*ngIf="courriel"
[href]="prepareMailtoLink(courriel)"
class="btn btn-sm btn-secondary mb-1"
(click)="$event.stopPropagation()">
<span role="img" class="ri-mail-line me-2 text-right" aria-hidden="true"></span>
Contacter
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,15 @@ export class InformationsPratiquesComponent {
@Input() public telephone: string | undefined;
@Input() public distance: number | undefined;
@Input() public status: OpeningState | undefined;

public prepareMailtoLink(courriels: string): string {
const courrielList = courriels.split(';');
let mailtoLink = `mailto:${courrielList[0]}`;

if (courrielList.length > 1) {
const ccEmails = courrielList.slice(1).join(',');
mailtoLink += `?cc=${ccEmails}`;
}
return mailtoLink;
}
}

0 comments on commit d1d39bf

Please sign in to comment.