# メール開発

ここでは Wantedly サービスを通じて配信されるメールの開発について解説します。 なお、説明は概要にとどめて細かい実装の詳細などは他のドキュメントで補完していくものとします。

## メールを送信する三つの方法

本ドキュメントでは 1 および 2 をスコープとします。3 については[管理画面からメールを送信する方法 (internal)](https://backstage.internal.wantedly.com/docs/default/component/wantedly/admin_user_mail_batch/#_1)を別途参照してください。

1. プロダクトコードに実装する
   * プロダクト機能として継続的に配信する場合はこちら
   * 例. 応募通知メール
   * [過去事例 (internal)](https://github.com/wantedly/visit/issues/4604)
2. 使い捨てのバッチスクリプトに実装する
   * 一度しか配信しない場合はこちら
   * 例. 新機能リリースメール
   * [過去事例 (internal)](https://github.com/wantedly/visit/issues/4713)
3. 専用管理画面から送信する
   * 非エンジニアがメールを送信する際はこちら
   * 例. メルマガ

## 特定電子メール法に関するガイドライン

プロダクト開発の施策として、企業・ユーザーにメール配信することがあります。エンジニアが各々の判断で配信してしまうと、メール配信が乱雑になったり不適切なメール内容になってしまうリスクがあります。ゆえに、Dev Branch ではルールを設けています。次のことを必ず守ってください。

* Squad 内の施策としてメール配信をする場合
  * Squad Leader の承認を Must とします
* 一つの Squad に閉じず、プロダクト横断的にメール配信をする場合 (eg. システムメンテナスなど)
  * 各 Tribe の PdM、システム責任者に事前連絡、Dev Branch Leader の承認を Must とします
* [メール配信システム](https://www.wantedly.com/admin/user_mail/batches) 経由でメール配信をする場合
  * Dev Branch Leader の承認を Must とします
* 参考
  * [迷惑メールの概要について](https://www.dekyo.or.jp/soudan/contents/taisaku/1-2.html)
  * [特定電子メールの送信の適正化等に関する法律](https://www.soumu.go.jp/main_sosiki/cybersecurity/kokumin/basic/legal/08/)

## 見るべきドキュメント

* [受信設定やレイアウトに関する仕様書 (internal)](https://backstage.internal.wantedly.com/docs/default/component/spec/mail/)
* [メール UI 実装 / メーラーの対応方針 (internal)](https://backstage.internal.wantedly.com/docs/default/component/dev/frontend/supported_mailers/)
* メール送信処理
  * [実装ドキュメント (internal)](https://backstage.internal.wantedly.com/docs/default/component/dev/frontend/emails/)
  * [QA テストの方法 (internal)](https://backstage.internal.wantedly.com/docs/default/component/dev/frontend/emails_qa/)
  * [本番送信の方法（internal）](https://backstage.internal.wantedly.com/docs/default/component/dev/frontend/send_emails_in_prod)
* 送信後の集計
  * [Looker を用いたメールの分析方法 (internal)](https://backstage.internal.wantedly.com/docs/default/component/dev/looker/mail-analysis)

## 推奨開発プロセス (未執筆)

#### 話を聞きに行きたい

* Slack: [#engineering](https://wantedly.slack.com/archives/C92AZFA2D)

#### もっと知りたい

* <https://github.com/wantedly/dev/issues/2286>
* <https://github.com/wantedly/dx/issues/456>
* <https://github.com/wantedly/dev/discussions/2288>


---

# 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://docs.wantedly.dev/fields/dev-process/mail.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.
