File size: 957 Bytes
9496ea8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from typing import Any, Optional
from smolagents.tools import Tool
import requests

class EmailValidateTool(Tool):
    name = "email_validate"
    description = "Mailvett by CyberMax: validate up to 10 email addresses (syntax, MX, disposable/role/free-provider flags, SPF/DMARC, typo suggestion) and get a deliverable/risky/undeliverable verdict with a score. Free tier, no key; paid keys at https://mailvett.cybermax-tools.workers.dev/docs"
    inputs = {'emails': {'type': 'string', 'description': "Comma-separated email addresses, e.g. 'ana@example.com,bob@gmial.com'"}}
    output_type = "object"

    def forward(self, emails: str):
        import requests
        r = requests.get("https://mailvett.cybermax-tools.workers.dev/api/validate",
                         params={"email": emails, "suggestTypos": "true", "via": "smolagents"}, timeout=30)
        return r.json()

    def __init__(self, *args, **kwargs):
        self.is_initialized = False