# EventFront MAIL API ドキュメント

### 概要

EventFront MAIL API は、メールアドレスが個人メールプロバイダーのものかを判定するAPIです。API認証を行い、リクエストされたメールアドレスのドメインが個人向けのものかを確認します。

100リクエスト当たり5円の利用料がかかります。

### エンドポイント

```
https://events-front.mixeder.net/v1/mail/
```

### 認証方式

このAPIを利用するには、APIキーが必要です。APIキーは以下のいずれかの方法で送信できます。

1. **GET パラメータ**: `?key=YOUR_API_KEY`
2. **POST パラメータ**: `api-key=YOUR_API_KEY`
3. **HTTP ヘッダー**: `api-key: YOUR_API_KEY`

### リクエスト形式

#### **POST リクエスト**

```
POST /v1/mail/ HTTP/1.1
Host: events-front.mixeder.net
Content-Type: application/x-www-form-urlencoded
api-key: YOUR_API_KEY

mail=user@example.com
```

#### **GET リクエスト (APIキーのみ確認用)**

```
GET /v1/mail/?key=YOUR_API_KEY HTTP/1.1
Host: events-front.mixeder.net
```

### レスポンス形式

| フィールド         | 型      | 説明                           |
| ------------- | ------ | ---------------------------- |
| `email`       | string | 確認対象のメールアドレス                 |
| `is_personal` | bool   | `true`なら個人メール、`false`なら企業メール |
| `error`       | string | エラー時のメッセージ (オプション)           |

#### **成功時のレスポンス例**

```
{
    "email": "user@gmail.com",
    "is_personal": true
}
```

```
{
    "email": "user@company.com",
    "is_personal": false
}
```

#### **エラー時のレスポンス例**

```
{
    "error": "Invalid email address"
}
```

```
{
    "error": "API key is missing"
}
```

### 導入事例・利用ケース

#### **1. ユーザー登録時のメールドメイン確認**

ユーザー登録フォームで、個人メールアドレスの利用を制限するために活用できます。

#### **2. 企業向けサービスのドメインフィルタリング**

企業メールのみ登録可能なサービスの実装に利用できます。

#### **3. メール分類システムの構築**

受信したメールアドレスを分類する用途で使用できます。

### サンプルコード

#### **PHP (file\_get\_contents 使用)**

```php
<?php
$url = 'https://events-front.mixeder.net/v1/mail/';
$apiKey = 'YOUR_API_KEY';
$mail = 'user@example.com';

$data = [
    'mail' => $mail
];

$options = [
    'http' => [
        'header'  => "Content-Type: application/x-www-form-urlencoded\r\n" .
                     "api-key: $apiKey\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    ]
];

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response === FALSE) {
    die('Error accessing API');
}

echo $response;
```

#### **PHP (cURL 使用)**

```php
<?php
$url = 'https://events-front.mixeder.net/v1/mail/';
$apiKey = 'YOUR_API_KEY';
$mail = 'user@example.com';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['mail' => $mail]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/x-www-form-urlencoded',
    'api-key: ' . $apiKey
]);

$response = curl_exec($ch);
curl_close($ch);

if ($response === FALSE) {
    die('Error accessing API');
}

echo $response;
```

#### **Python (requests 使用)**

```python
import requests

url = 'https://events-front.mixeder.net/v1/mail/'
api_key = 'YOUR_API_KEY'
mail = 'user@example.com'

headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'api-key': api_key
}

data = {
    'mail': mail
}

response = requests.post(url, headers=headers, data=data)

if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}")
```

### 備考

* APIキーは第三者に漏れないようにしてください。
* APIの利用制限や料金プランについては、管理者にお問い合わせください。
* メールドメインリストは定期的に更新されるため、常に最新のリストを参照してください。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.mixeder.net/mixederpublicapis/apirifarensu/eventfront-mail-api-dokyumento.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
