-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse SMTP bounce emails
- Loading branch information
Showing
9 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<script setup lang="ts"> | ||
// import { RE2 } from 're2-wasm'; | ||
import EmailBounceParse from 'email-bounce-parser-browser'; | ||
window.Module = { chier: 12 }; | ||
const emailContent = ref(''); | ||
const parsedBounce = computed(() => { | ||
try { | ||
return { email: new EmailBounceParse().read(emailContent.value) }; | ||
} | ||
catch (e: any) { | ||
return { parsingError: e.toString() }; | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div style="max-width: 600px;"> | ||
<c-card title="Input" mb-2> | ||
<c-input-text | ||
v-model:value="emailContent" | ||
label="Bounce Email Textual Content" | ||
multiline | ||
placeholder="Put your email text content here..." | ||
rows="15" | ||
mb-2 | ||
/> | ||
</c-card> | ||
|
||
<c-card v-if="parsedBounce && emailContent" title="Output"> | ||
<n-p v-if="parsedBounce.email?.bounce" style="color: green"> | ||
This mail is a bounce email | ||
</n-p> | ||
<n-p v-if="!parsedBounce.email?.bounce" style="color: red"> | ||
This mail is NOT a bounce email | ||
</n-p> | ||
<c-alert v-if="!parsedBounce.parsingError"> | ||
{{ parsedBounce.parsingError }} | ||
</c-alert> | ||
<input-copyable v-if="parsedBounce.email?.recipient" label="Recipient" :value="parsedBounce.email?.recipient" /> | ||
<input-copyable v-if="parsedBounce.email?.server?.hostname" label="Server (Host)" :value="parsedBounce.email?.server?.hostname" /> | ||
<input-copyable v-if="parsedBounce.email?.server?.ip" label="Server (IP)" :value="parsedBounce.email?.server?.ip" /> | ||
<input-copyable v-if="parsedBounce.email?.server?.port" label="Server (Port)" :value="parsedBounce.email?.server?.port" /> | ||
<input-copyable v-if="parsedBounce.email?.command" label="Recipient" :value="parsedBounce.email?.command" /> | ||
<c-card v-if="parsedBounce.email?.data" title="Details" mb-2> | ||
<textarea-copyable :value="JSON.stringify(parsedBounce.email?.data, null, 2)" /> | ||
</c-card> | ||
<c-card v-if="parsedBounce.email?.email?.error" title="Raw Error" mb-2> | ||
<textarea-copyable :value="parsedBounce.email?.email?.error" /> | ||
</c-card> | ||
</c-card> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
declare module "email-bounce-parser-browser" { | ||
export default class EmailBounceParse { | ||
read(emailContent: string): { | ||
bounce: boolean | ||
recipient?: string | ||
data: any | ||
command: string | ||
server?: { | ||
hostname: string | ||
ip: string | ||
port: string | ||
} | ||
email?: { | ||
error?: string | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Mailbox } from '@vicons/tabler'; | ||
import { defineTool } from '../tool'; | ||
|
||
export const tool = defineTool({ | ||
name: 'Bounce Email Parser', | ||
path: '/bounce-parser', | ||
description: 'Parse SMTP Bounce Emails', | ||
keywords: ['bounce', 'email', 'smtp', 'parser'], | ||
component: () => import('./bounce-parser.vue'), | ||
icon: Mailbox, | ||
createdAt: new Date('2024-08-15'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters