Check the status of a specified email address.
1
type Abstractapi = {
2
apiKey: string
3
}
4
5
export async function main(resource: Abstractapi, email: string) {
6
const queryParams = new URLSearchParams({
7
api_key: resource.apiKey,
8
email,
9
auto_correct: 'false'
10
})
11
12
const endpoint = `https://emailvalidation.abstractapi.com/v1?${queryParams.toString()}`
13
14
const response = await fetch(endpoint, {
15
method: 'GET'
16
17
18
if (!response.ok) {
19
throw new Error(`HTTP error! status: ${response.status}`)
20
21
22
const data = await response.json()
23
24
return data
25
26