feat: Add SMTP mail sending feature via msmtp
All checks were successful
Helm Chart Release / release-chart (push) Successful in 5s

PHPアプリケーションからSMTP経由でメール送信を行う機能を追加。
msmtpをPHP-FPMコンテナに統合し、mail()関数で直接利用可能。

Features:
- STARTTLS(port 587)とSSL/TLS(port 465)に対応
- 送信元アドレスは固定だがPHPで上書き指定可能
- パスワードはKubernetes Secretで安全に管理
- 自己署名証明書対応オプション
- Gmail、Office365など一般的なSMTPサーバーに対応

Changes:
- values.yaml: smtp設定セクションを追加
- templates/secret-smtp.yaml: パスワード管理用Secret
- templates/configmap-smtp.yaml: msmtprc設定ファイル生成
- templates/configmap-smtp.yaml: PHPヘルパークラス(SmtpConfig)
- templates/deployment.yaml: msmtpインストールと設定
- README.md: SMTP設定パラメータ表と使用例を追加

Protocol support:
- auto: 自動判定(推奨)
- starttls: SMTP + STARTTLS(ポート587)
- tls: SSL/TLS(ポート465)

PHP Usage:
  SmtpConfig::init();
  mail($to, $subject, $body);
  // または別の送信者で上書き
  SmtpConfig::mail($to, $subject, $body, $headers, 'custom@example.com');

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 10:40:07 +09:00
parent 8b7a141caa
commit 06c63037f1
5 changed files with 385 additions and 2 deletions

View File

@@ -130,4 +130,47 @@ externalDatabase:
username: user
password: pass
# SMTP設定PHPのメール送信用
smtp:
enabled: false
# SMTPサーバー設定
host: "smtp.example.com"
# プロトコルとポート設定
# - auto: 自動判定(推奨)
# - starttls: STARTTLSポート587
# - tls: SSL/TLSポート465
protocol: "auto"
# ポート番号(通常は自動判定されるため手動設定は不要)
# protocol: auto の場合は以下の値を参考に
# - 25: SMTP (非暗号化)
# - 587: SMTP + STARTTLS (暗号化)
# - 465: SMTP + SSL/TLS (暗号化)
port: 587
# 認証設定
auth:
enabled: true
username: "smtp-user@example.com"
# password はSecretで管理する
# values-secret.yaml などで以下のように指定:
# smtp:
# auth:
# password: "your-smtp-password"
password: ""
# 送信元アドレス(固定値)
# PHPプログラムで mail() 関数の $additional_parameters で上書き可能
# 例: mail($to, $subject, $body, $headers, "-f user@example.com")
from: "noreply@example.com"
# TLS/SSL設定
tls:
# 証明書検証を有効化(本番環境では true を推奨)
verify: true
# 自己署名証明書を許可する場合(テスト環境のみ)
allowSelfSigned: false
resources: {}