[Ghost]ユーザーメール登録の設定方法
![[Ghost]ユーザーメール登録の設定方法](/content/images/size/w960/2025/08/ghost_mailgun_static_image-1.png)
問題の症状
初期状態でGhost でニュースレター登録を試すと以下のエラーが発生しました.
- 記事ページ上では, "Failed to sign up, please try again"とポップアップがでる.
- ghost log の表示は, EmailError: Failed to send email. Reason: Sending failed.
原因
Ghost管理画面でMailgunを設定しても,config.production.json
でメール設定が"transport": "Direct"
のままになっており,Mailgun設定が反映されていない.
解決方法
1. 設定ファイル確認
cd /var/www/ghost
cat config.production.json
# 以下のような設定になっている場合が問題:
"mail": {
"transport": "Direct"
}
2. 手動設定変更
ghost の停止
ghost stop
設定ファイル編集
- mail設定を以下に変更
sudo vi config.production.json
# 以下の部分を修正
"mail": {
"transport": "Mailgun",
"options": {
"auth": {
"api_key": "your-mailgun-api-key",
"domain": "mail.yourdomain.com"
}
}
}
- 権限エラー対応(必要に応じて)
sudo find ./ ! -path "./versions/*" -type f -exec chmod 664 {} ;
- Ghost再起動
ghost start
- 動作確認
- ニュースレター登録テスト
- ghost log --followでエラーログ監視
注意点
- Ghost管理画面でのMailgun設定だけでは不十分な場合がある
- 設定ファイルの直接編集が必要
- API keyとドメインは正確に入力する
- 設定変更後は必ずGhost再起動