{{- if .Values.smtp.enabled }} apiVersion: v1 kind: ConfigMap metadata: name: {{ include "phpfpm.fullname" . }}-smtp-config labels: {{- include "phpfpm.labels" . | nindent 4 }} data: msmtprc: | # msmtp設定ファイル # PHPのsendmail_pathから呼び出される defaults {{- if .Values.smtp.tls.verify }} tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt {{- else }} tls off {{- end }} {{- if .Values.smtp.tls.allowSelfSigned }} tls_certcheck off {{- else }} tls_certcheck on {{- end }} {{- if eq .Values.smtp.protocol "starttls" }} # STARTTLS (SMTP + STARTTLS at port 587) protocol smtp {{- else if eq .Values.smtp.protocol "tls" }} # SSL/TLS (SMTPS at port 465) protocol smtps {{- else }} # Auto mode - protocol will be determined by port {{- if eq (int .Values.smtp.port) 465 }} protocol smtps {{- else }} protocol smtp {{- end }} {{- end }} account default host {{ .Values.smtp.host }} port {{ .Values.smtp.port }} {{- if eq .Values.smtp.protocol "starttls" }} protocol smtp {{- else if eq .Values.smtp.protocol "tls" }} protocol smtps {{- else if eq (int .Values.smtp.port) 465 }} protocol smtps {{- else }} protocol smtp {{- end }} {{- if .Values.smtp.auth.enabled }} auth on user {{ .Values.smtp.auth.username }} passwordeval "cat /etc/smtp-secrets/password" {{- else }} auth off {{- end }} from {{ .Values.smtp.from }} {{- if .Values.smtp.tls.verify }} tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt {{- else }} tls off {{- end }} {{- if .Values.smtp.tls.allowSelfSigned }} tls_certcheck off {{- else }} tls_certcheck on {{- end }} # PHPスクリプトで利用する設定用PHPクラス php-smtp-config.php: | ini_get('sendmail_path'), 'sendmail_from' => ini_get('sendmail_from'), 'SMTP' => ini_get('SMTP'), 'smtp_port' => ini_get('smtp_port'), ]; } } {{- end }}