# Email Finder

Find a person's professional email from their name and company domain. You have names and companies (leads, event attendees, a CRM export) and need a professional email for each person.

**Credits:** 1 search credit when an email is found (+5 per phone with enrich_mobile). Lookups that find nothing cost nothing. See [Pricing and limits](../pricing-and-limits).

## Inputs and options

Any one of these input combinations:

- `domain` (Company domain) + `first_name` (First name) + `last_name` (Last name)
- `domain` (Company domain) + `full_name` (Full name)
- `company` (Company name) + `first_name` (First name) + `last_name` (Last name)
- `company` (Company name) + `full_name` (Full name)

| Option          | Type    | Default | Description                                              |
| --------------- | ------- | ------- | -------------------------------------------------------- |
| `enrich_mobile` | BOOLEAN | `false` | Also look up mobile phones (+5 credits per phone found). |

## Try one value

```sql
CALL TOMBA.core.email_finder('acme.com', 'Jane', 'Doe');
```

The call returns the result as a `VARIANT` (example values, shortened):

```json
{
    "status": "found",
    "credits": 1,
    "results": [
        {
            "EMAIL": "jane.doe@acme.com",
            "SCORE": 97,
            "VERIFICATION_STATUS": "valid",
            "POSITION": "Head of Sales"
        }
    ]
}
```

`status` is `found`, `not_found`, `invalid` or `error`; `results` holds the output columns and `data` the complete
Tomba record.

## Run it over a table

Create a small table to try it (or use one of yours, after [granting the app access](../installation#3-let-the-app-read-your-tables)):

```sql
CREATE OR REPLACE TABLE my_db.public.leads (COMPANY_DOMAIN STRING, FIRST_NAME STRING, LAST_NAME STRING);
INSERT INTO my_db.public.leads VALUES
    ('acme.com', 'Jane', 'Doe'),
    ('globex.com', 'John', 'Smith');
GRANT SELECT ON TABLE my_db.public.leads TO APPLICATION TOMBA;
```

Run the tool, then read the results:

```sql
CALL TOMBA.core.find_emails('MY_DB.PUBLIC.LEADS', 'COMPANY_DOMAIN', 'FIRST_NAME', 'LAST_NAME', 'LEADS_EMAIL_FINDER', 100);

SELECT INPUT_DOMAIN, INPUT_FIRST_NAME, INPUT_LAST_NAME, EMAIL, SCORE, VERIFICATION_STATUS, POSITION
  FROM TOMBA.results.LEADS_EMAIL_FINDER
 WHERE lookup_status = 'found';
```

Signature: `find_emails(input_table STRING, domain_column STRING, first_name_column STRING, last_name_column STRING, output_table STRING, max_rows INT DEFAULT 100000)`

### Other inputs with `run_tool`

With a full name and a company name instead of a domain:

```sql
CALL TOMBA.core.run_tool('email_finder', 'MY_DB.PUBLIC.LEADS', {'company': 'COMPANY_NAME', 'full_name': 'CONTACT_NAME'},
                         'LEADS_EMAIL_FINDER_2', 100, {});
```

<Callout type="tip">
    Start with a small `max_rows` (like 100) to check the match rate on your
    data, then run the whole table, in the [background](../background-runs) if
    it is large.
</Callout>

## Output columns

Each row starts with `INPUT_<name>` columns (your values, unchanged) and then has:

`EMAIL`, `SCORE`, `VERIFICATION_STATUS`, `FIRST_NAME`, `LAST_NAME`, `FULL_NAME`, `POSITION`, `DEPARTMENT`, `COMPANY`, `WEBSITE_URL`, `COUNTRY`, `LINKEDIN`, `TWITTER`, `EMAIL_TYPE`, `ACCEPT_ALL`, `PHONE_NUMBER`, followed by the [common columns](../reference/output-columns)
(`LOOKUP_STATUS`, `CREDITS`, `DATA`, `SOURCE`, …).

## Tips

- `SCORE` is Tomba's confidence (0–100); `VERIFICATION_STATUS` tells you whether the address was verified.
- The table procedure takes domain + first + last name. For full names or company names, use `run_tool` as shown above.
- Add `{'enrich_mobile': true}` in `run_tool` options to also get a mobile number (+5 credits per phone found).

## Related

- [Email Verifier](./email-verifier)
- [LinkedIn Finder](./linkedin-finder)
- [Domain Search](./domain-search)
