mailjet-apiv3-nodejs icon indicating copy to clipboard operation
mailjet-apiv3-nodejs copied to clipboard

Email validation

Open golu7679 opened this issue 1 year ago • 2 comments

How can I check given email is not a disposable email?

golu7679 avatar May 22 '24 16:05 golu7679

@golu7679 I will love to tackle this issue. Can you assign it to me?

carrington-115 avatar Jun 15 '24 04:06 carrington-115

@carrington-115 I dont have permission to assign the issue in any.

golu7679 avatar Jun 17 '24 15:06 golu7679

Hello @golu7679 You have few options to do that, and both of them require to download the CSV at the end of validation.

  • First option is to use the UI https://documentation.mailjet.com/hc/en-us/articles/1260803104410-Bulk-Validations.

  • The second option is using API and it requires more steps:

    • Create contact list that will be used for validation, and store it's ID (<Your contact list Id>), to use it on the next steps. Link to doc
    • In case contact for email is already created then use subscriptions Link to doc to link the existing contact with list. Otherwise create Contacts via managecontact action Link to doc. Use Id <Your contact list Id> from previous step to link the contact with Contacts list directly on creation step.
    • Start verification job Link to doc, and store the ID for verification job (<verification job id>)
    • Wait few minutes until verification is completed
    • Get the verification results with https://dev.mailjet.com/email/reference/contacts/verifications/#v3_get_contactslist_list_ID_verify_job_ID For some reason the Node.js example for verify action isn't precise, so you can use the next snippet to get the result
      const result = await mailjet
          .get("contactslist", {'version': 'v3'})
          .id(<Your contact list Id>)
          .action("verify")
          .id(<verification job id>)
          .request();
      
      console.log(mjSubscription.body.Data[0]);
      
    • Use ResponseUrl value from response object on previous step to get the downloading link for .CSV file with results.
  • open the CSV file and check the is_disposable_address column to understand did email presented in a list of known disposable email addresses

olexandr-mazepa avatar Mar 10 '25 14:03 olexandr-mazepa