fix(core): update
This commit is contained in:
@ -1 +1,2 @@
|
||||
export * from './smartmail.classes.smartmail';
|
||||
export * from './smartmail.classes.emailaddressvalidator';
|
||||
|
19
ts/smartmail.classes.emailaddressvalidator.ts
Normal file
19
ts/smartmail.classes.emailaddressvalidator.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import * as plugins from './smartmail.plugins';
|
||||
|
||||
export interface IEmailValidationResult {
|
||||
valid: boolean;
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export class EmailAddressValidator {
|
||||
public smartdns = new plugins.smartdns.Smartdns({});
|
||||
|
||||
public async validate(emailArg: string): Promise<IEmailValidationResult> {
|
||||
const emailArray = emailArg.split('@');
|
||||
const result = await this.smartdns.getRecord(emailArray[1], 'MX');
|
||||
return {
|
||||
valid: !!result,
|
||||
reason: 'todo'
|
||||
};
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import * as smartdns from '@pushrocks/smartdns';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartmustache from '@pushrocks/smartmustache';
|
||||
|
||||
export { smartfile, smartmustache };
|
||||
export { smartdns, smartfile, smartmustache };
|
||||
|
Reference in New Issue
Block a user