NeverBounce is a service that provides real-time email verification and validation. It helps businesses to ensure that the email addresses they collect are valid and deliverable. NeverBounce enables organizations to identify and remove invalid, risky, and low-quality email addresses from their mailing lists, optimizing their email marketing efforts and enhancing their sender reputation. Implementing the NeverBounce validation to the email field in the engaging networks form is an easy task.
General Steps To Implementing NeverBounce In Your Application.
- Sign up to the Neverbounce (https://neverbounce.com/)
- Login to the account to retrieve the key and check the API documentation
- Add a field in the form for email.
<input id="en__field_supporter_emailAddress" type="email" class="en__field__input en__field__input--email" name="supporter.emailAddress" value="" >
- Add the script for loading the NeverBounce.
<script type="text/javascript">
_NBSettings = {
apiKey: 'YOUR_KEY’',
displayPoweredBy: false,
;acceptedMessage: "Valid email",
inputLatency: 480,
timeout: 1,
acceptedStatusCodes: [0,4],
rejectedMessage: "Help keep online activism effective. Please enter a valid email address.",
};
loadJS("https://cdn.neverbounce.com/widget/dist/NeverBounce.js");
function loadJS(file) {
// DOM: Create the script element
var jsElm = document.createElement("script");
// set the type attribute
jsElm.type = "application/javascript";
// make the script element load file
jsElm.src = file;
// finally insert the element to the body element in order to load the script
document.body.appendChild(jsElm);
}
</script>
_NBSettings contains various settings for the NeverBounce widget. It includes the API key (apiKey) used for making API requests, whether to display the “Powered By NeverBounce” badge (displayPoweredBy), input latency in milliseconds (inputLatency), timeout in seconds for API requests (timeout), an array of accepted status codes (acceptedStatusCodes), and a custom rejection message (rejectedMessage) to be displayed when an invalid email is entered. In the accepted message displayed in the feedback div when email is acceptable. Default accepted codes are valid(0), catchall(3) and unknown(4). - Customize the event by adding the below code.
document.querySelector('body').addEventListener('nb:registered', function (event) {
// Get field using id from registered event
let field = document.querySelector('[data-nb-id="' + event.detail.id + '"]');
// Handle clear events (input has changed or an API error was returned)
field.addEventListener('nb:clear', function(e) {
// Check for errors
if (e.detail.result && e.detail.result.isError()) {
if (e.detail.result.isThrottled()) {
// console.log("false email");
// Do stuff when the verification is throttled }
// Do stuff when other API errors occur
// - Our recommendation is to hide any loaders and treat these emails the same way you would treat an Unknown email
}
// Do stuff when input changes, (e.g. hide loader)
});
// Handle loading status (API request has been made)
field.addEventListener('nb:loading', function(e) {
// Do stuff while waiting on API response
});
// Handle results (API call has succeeded)
setTimeout(field.addEventListener('nb:result', function(e) {
if (e.detail.result.is(_nb.settings.getAcceptedStatusCodes())) {
// Do stuff for good email
}
else {
// Do stuff for bad email
}
}),10);
// Handle soft results (fails regex; doesn't bother making API request)
field.addEventListener('nb:soft-result', function(e) {
// Do stuff when input doesn't even look like an email (i.e. missing @ or no .com/.net/etc...)
});
});
From the code above, it is clear that the widget will accept any fields with the “email” type or the “data-nb” attribute. However, this only applies to fields that are already in the DOM when the page first loads. Once a field has been added to the DOM of the page, you must call the “registerListener” method in order to register it. By following these instructions, you may easily include NeverBounce in your application, assisting you in maintaining a clean and deliverable email list.
In conclusion, integrating NeverBounce email verification and validation into your application can improve the quality of the email addresses gathered. It also enhances your email marketing operations.
Here at Sreyas IT Solutions, we give much importance to our client satisfaction. We provide different services related to NeverBounce and others are provided to fulfill customer requirements. Web and mobile application that are user-friendly and has the best UIUX is what make us stand out. Websites built at Sreyas are equipped with all the techniques to improve the page speed score. Thus rank high in organic search. Services like e-commerce application development, data migration, database management, infrastructure management, etc. are also provided by Sreyas globally.