platformservice/ts/mta/mta.classes.email.ts

37 lines
725 B
TypeScript
Raw Normal View History

2024-02-16 12:28:40 +00:00
export interface IAttachment {
filename: string;
content: Buffer;
contentType: string;
}
export interface IEmailOptions {
from: string;
to: string;
subject: string;
text: string;
attachments: IAttachment[];
mightBeSpam?: boolean;
}
export class Email {
from: string;
to: string;
subject: string;
text: string;
attachments: IAttachment[];
mightBeSpam: boolean;
constructor(options: IEmailOptions) {
this.from = options.from;
this.to = options.to;
this.subject = options.subject;
this.text = options.text;
this.attachments = options.attachments;
this.mightBeSpam = options.mightBeSpam || false;
}
public getFromDomain() {
return this.from.split('@')[1]
}
}