Created by rubenmanhague 296 days ago Viewed 53 times 0 Points
Email Address Validation is a paid service from Sendgrid and it's available to Email API Pro and Premier level accounts only.
No comments yet
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts"
import sendgrid from "npm:@sendgrid/client@^7.7.0"
export async function main(
api_token: wmill.Resource<"sendgrid">,
email: string,
source?: string,
) {
sendgrid.setApiKey(api_token.token);
const request = {
url: `/v3/validations/email`,
method: 'POST',
body: {
email,
source
}
}
try {
const [_, body] = await sendgrid.request(request)
return body
} catch (error) {
throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
}
}
No comments yet