After including the library, initialize the Blocker to start protecting your forms:
Code
import { Blocker } from "disposable-email-blocker";// Initialize with default settingsnew Blocker();
Alternatively, if included via a CDN:
Code
<script src="https://cdn.jsdelivr.net/npm/disposable-email-blocker/disposable-email-blocker.min.js"></script><script> new Disposable.Blocker();</script>
Customizing Error Messages
You can customize the error messages displayed when a disposable or webmail email is detected:
Code
new Blocker({ messages: { disposable: "Disposable email addresses are not allowed.", webmail: "Please use your professional email address.", },});
Blocking Webmail Services
By default, the blocker focuses on disposable email services. To extend protection to webmail services (e.g., Gmail, Yahoo), enable the blockWebmail option: