メール転送

メール & セキュリティ
受信メッセージをあるアドレスから別のアドレスに転送するメール ルーティング設定。
← 用語集に戻る

メール転送とは

「メール転送とは」では、目的と基本的な考え方を説明します。

メール転送の仕組み

「メール転送の仕組み」では、処理の流れと確認点を整理します。

1. Email sent to: [email protected]

2. Mail server receives at MX: mail.example.com

3. Server checks forwarding rules

4. Email forwarded to: [email protected]

5. Team receives email (appears from original sender)

メール転送の種類

「メール転送の種類」では、実装時の選択肢と注意点を示します。

簡単な転送

「簡単な転送」では、運用で確認すべき事項をまとめます。

[email protected][email protected]

複数宛先への転送

「複数宛先への転送」では、障害を避けるための実務上の要点を説明します。

[email protected] → {

[email protected],

[email protected],

[email protected]

}

条件付き転送

「条件付き転送」では、安全な利用と検証の方法を示します。

If subject contains "urgent" → [email protected]

If from VIP domain → [email protected]

Else → [email protected]

ドメイン単位の転送

「ドメイン単位の転送」では、目的と基本的な考え方を説明します。

*@old-domain.com → *@new-domain.com

メール転送の設定

「メール転送の設定」では、処理の流れと確認点を整理します。

cPanel

「cPanel」では、実装時の選択肢と注意点を示します。

1. Email → Forwarders

2. Add Forwarder

3. Address to Forward: [email protected]

4. Forward to: [email protected]

5. Add Forwarder

Postfix(Linux)

「Postfix(Linux)」では、運用で確認すべき事項をまとめます。

# /etc/aliases

sales: [email protected]

# Or for virtual domains

# /etc/postfix/virtual

[email protected] [email protected]

# Apply changes

newaliases # For /etc/aliases

# or

postmap /etc/postfix/virtual && systemctl reload postfix

Gmail転送

「Gmail転送」では、障害を避けるための実務上の要点を説明します。

1. Settings → Forwarding and POP/IMAP

2. Add a forwarding address

3. Verify forwarding address (click link in confirmation email)

4. Enable forwarding

5. Choose what to do with original (keep, archive, delete)

Microsoft 365

「Microsoft 365」では、安全な利用と検証の方法を示します。

1. Admin Center → Users → Active users

2. Select user → Mail tab

3. Email forwarding → Manage email forwarding

4. Forward all email to: [email protected]

5. Save changes

Google Workspace(ドメイン全体)

「Google Workspace(ドメイン全体)」では、目的と基本的な考え方を説明します。

1. Admin Console → Apps → Google Workspace → Gmail

2. Routing → Add Route

3. For recipient: Single recipient or All recipients

4. Forward to: [email protected]

5. Options: Change route, Modify headers

メール転送とエイリアスの違い

「メール転送とエイリアスの違い」では、処理の流れと確認点を整理します。

項目転送エイリアス
配信先別のアドレス同じメールボックス
元のアドレスの保存なしあり
メールボックスへの表示なしあり(エイリアスとして)
認証SPF/DKIMが壊れる場合がある認証を維持
適した用途外部ルーティング複数アドレスを1つの受信トレイへ
この表は、転送とエイリアスの動作上の違いを示します。
Alias:

[email protected] } → Same mailbox

[email protected] } (both deliver to mailbox, different addresses)

Forwarding:

[email protected][email protected]

(only delivers to [email protected], nothing in sales mailbox)

SPFとメール転送

「SPFとメール転送」では、実装時の選択肢と注意点を示します。

問題

「問題」では、運用で確認すべき事項をまとめます。

1. Sender: [email protected] sends to [email protected]

2. Forwarder: [email protected] forwards to [email protected]

3. Final server checks SPF:

- Envelope From: [email protected]

- Sending IP: forwarder.com's IP

- SPF Check: Does sender.com authorize forwarder.com's IP?

- Result: Usually FAIL (forwarder not in sender.com's SPF)

解決策

「解決策」では、障害を避けるための実務上の要点を説明します。

Forwarder rewrites envelope sender:

Original: MAIL FROM: <[email protected]>

Rewritten: MAIL FROM: <[email protected]>

Now SPF checks forwarder.com's SPF (passes)

# Install postsrsd

apt-get install postsrsd

# /etc/postfix/main.cf

sender_canonical_maps = tcp:127.0.0.1:10001

recipient_canonical_maps = tcp:127.0.0.1:10002

systemctl restart postsrsd postfix

ARC-Authentication-Results: forwarder.com;

spf=pass smtp.mailfrom=sender.com

dkim=pass header.d=sender.com

DKIMと転送

「DKIMと転送」では、安全な利用と検証の方法を示します。

DKIMを壊す一般的な変更

「DKIMを壊す一般的な変更」では、目的と基本的な考え方を説明します。

DKIMを保持する

「DKIMを保持する」では、処理の流れと確認点を整理します。

# Postfix: Don't add disclaimers to forwarded mail

smtpd_discard_ehlo_keywords = silent-discard

# Add forwarder's DKIM signature

# Original sender's signature may break, but forwarder's passes

メール転送のベストプラクティス

「メール転送のベストプラクティス」では、実装時の選択肢と注意点を示します。

転送を必要最小限にする

「転送を必要最小限にする」では、運用で確認すべき事項をまとめます。

Instead of: [email protected][email protected]

Use: John checks [email protected] directly via IMAP/webmail

外部転送にSRSを実装する

「外部転送にSRSを実装する」では、障害を避けるための実務上の要点を説明します。

Internal forwarding:  [email protected][email protected] (safe)

External forwarding: [email protected][email protected] (use SRS)

転送ループを監視する

「転送ループを監視する」では、安全な利用と検証の方法を示します。

A forwards to B

B forwards to A

= Loop

Solution: Postfix max_hop_count limit (default 50)

配信通知を設定する

「配信通知を設定する」では、目的と基本的な考え方を説明します。

# Postfix

notify_classes = bounce, resource, software

転送ルールを文書化する

「転送ルールを文書化する」では、処理の流れと確認点を整理します。

# forwarding-rules.md

| From | To | Purpose | Owner | Created |

|------|----|---------| ------|---------|

| [email protected] | [email protected] | CRM integration | IT | 2024-01 |

定期的に監査する

「定期的に監査する」では、実装時の選択肢と注意点を示します。

# List all forwards (Postfix)

grep -v "^#" /etc/postfix/virtual | grep "@.*@"

# Check for outdated destinations

# Remove forwards for terminated employees

一般的な転送の問題

「一般的な転送の問題」では、運用で確認すべき事項をまとめます。

転送が静かに失敗する

「転送が静かに失敗する」では、障害を避けるための実務上の要点を説明します。

# Check mail logs

tail -f /var/log/mail.log | grep "forwarding"

# Test forwarding

echo "Test" | mail -s "Test" [email protected]

# Check if it arrives at destination

転送メールのSPF失敗

「転送メールのSPF失敗」では、安全な利用と検証の方法を示します。

転送遅延

「転送遅延」では、目的と基本的な考え方を説明します。

# Check Postfix queue

mailq

# Process queue immediately

postqueue -f

宛先で転送メールがスパム扱いになる

「宛先で転送メールがスパム扱いになる」では、処理の流れと確認点を整理します。

特定の用途での転送

「特定の用途での転送」では、実装時の選択肢と注意点を示します。

一時転送(休暇)

「一時転送(休暇)」では、運用で確認すべき事項をまとめます。

# .forward file (user home directory)

\myuser, [email protected]

# Delivers to both user's mailbox and colleague

ローカルコピーを残す転送

「ローカルコピーを残す転送」では、障害を避けるための実務上の要点を説明します。

# Keep copy in original mailbox while forwarding

# Postfix virtual:

[email protected] [email protected], [email protected]

部署への配布

「部署への配布」では、安全な利用と検証の方法を示します。

# /etc/aliases

sales: [email protected], [email protected], [email protected]

外部サービスとの統合

「外部サービスとの統合」では、目的と基本的な考え方を説明します。

# Forward to ticket system

[email protected][email protected]

# Forward to Slack email

[email protected][email protected]

セキュリティ上の考慮事項

「セキュリティ上の考慮事項」では、処理の流れと確認点を整理します。

個人メールへの転送

「個人メールへの転送」では、実装時の選択肢と注意点を示します。

外部転送の開示

「外部転送の開示」では、運用で確認すべき事項をまとめます。

転送を攻撃ベクトルに使う

「転送を攻撃ベクトルに使う」では、障害を避けるための実務上の要点を説明します。

# Detection

# Alert on new forwarding rules:

monitor /etc/postfix/virtual for changes

monitor Exchange/M365 forwarding rule creations

メール転送をテストする

「メール転送をテストする」では、安全な利用と検証の方法を示します。

# Send test email

echo "Test forwarding" | mail -s "Forwarding Test" [email protected]

# Check logs on forwarding server

tail -f /var/log/mail.log

# Verify arrival at destination

# Check destination mailbox

Send email through forwarding chain

Check authentication headers at destination:

Authentication-Results: destination.com;

spf=pass (forwarder: domain of source.com designates <IP> as permitted sender)

dkim=pass header.d=source.com

この知識を実践する

DomScan の API を使用してドメインの可用性、状態などを確認します。