Skip to content

Instantly share code, notes, and snippets.

@Sparticuz
Created August 11, 2020 14:48
Show Gist options
  • Save Sparticuz/65f8849e73ba72a044f5d7084281cd08 to your computer and use it in GitHub Desktop.
Save Sparticuz/65f8849e73ba72a044f5d7084281cd08 to your computer and use it in GitHub Desktop.
declare interface Headers {
name: string;
value: string;
}
declare interface CommonHeaders {
date?: string;
from?: string[];
messageId?: string;
subject?: string;
to?: string[];
}
declare interface BouncedRecipients {
action?: string;
diagnosticCode?: string;
emailAddress: string;
status?: string;
}
export enum notificationTypes {
BOUNCE = "Bounce",
COMPLAINT = "Complaint",
DELIVERY = "Delivery",
}
export enum bounceTypes {
PERMANENT = "Permanent",
TRANSIENT = "Transient",
UNDETERMINED = "Undetermined",
}
export enum bounceSubTypes {
ATTACHMENTREJECTED = "AttachmentRejected",
CONTENTREJECTED = "ContentRejected",
GENERAL = "General",
MAILBOXFULL = "MailboxFull",
MESSAGETOOLARGE = "MessageTooLarge",
NOEMAIL = "NoEmail",
SUPPRESSED = "Suppressed",
UNDETERMINED = "Undetermined",
}
export enum complaintTypes {
ABUSE = "abuse",
AUTHFAILURE = "auth-failure",
FRAUD = "fraud",
NOTSPAM = "not-spam",
OTHER = "other",
VIRUS = "virus",
}
export declare interface Notification {
bounce?: {
bounceSubType: bounceSubTypes;
bounceType: bounceTypes;
bouncedRecipients: BouncedRecipients[];
feedbackId: string;
remoteMtaIp?: string;
reportingMTA?: string;
timestamp: string;
};
complaint?: {
arrivalDate?: string;
complainedRecipients: { emailAddress: string }[];
complaintFeedbackType?: complaintTypes;
feedbackId: string;
timestamp: string;
userAgent?: string;
};
delivery?: {
processingTimeMillis: number;
recipients: string[];
remoteMtaIp: string;
reportingMTA: string;
smtpResponse: string;
timestamp: string;
};
mail: {
commonHeaders?: CommonHeaders;
destination: string[];
headers?: Headers[];
headersTruncated?: boolean;
messageId: string;
sendingAccountId: string;
source: string;
sourceArn: string;
sourceIp: string;
timestamp: string;
};
notificationType: notificationTypes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment