37 lines
725 B
TypeScript
37 lines
725 B
TypeScript
|
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]
|
||
|
}
|
||
|
}
|