From 483895b4de6ca772ad5f7a85c9ffd32d01c84cc6 Mon Sep 17 00:00:00 2001 From: Remi Date: Tue, 5 Feb 2019 12:41:59 -0500 Subject: [PATCH] URL encode email addresses before sending the GET request emails containing `+` character (which are valid) otherwise don't get validated. --- ZeroBounceApi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZeroBounceApi.js b/ZeroBounceApi.js index 5cbd4b3..4666920 100644 --- a/ZeroBounceApi.js +++ b/ZeroBounceApi.js @@ -26,7 +26,7 @@ class ZeroBounceApi { * @return - a JSONObject with all of the information for the specified email * */ this.validate = function(email, ip_address){ - var uri = baseUrl + "/validate" + "?api_key=" + apiKey + "&email=" + email + "&ip_address=" + ip_address; + var uri = baseUrl + "/validate" + "?api_key=" + apiKey + "&email=" + encodeURIComponent(email) + "&ip_address=" + ip_address; get.open('GET', uri, false); get.send(); if (get.readyState == 4 && get.status == 200) {