0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Added from address to Dev Container's auto configuration (#21442)

refs
https://linear.app/ghost/issue/ENG-1686/mail-auto-configuration-doesnt-work

- Previously the `mail` configuration that is auto-generated didn't work
because the `from` address wasn't being set, and requests were
consequently failing due to some Mailgun internal validation.
- This change requires the `MAILGUN_FROM_ADDRESS` environment variable
to be set for it to automatically configure the `mail` block, and if it
is, it adds it as `mail.from`. Now with all three of
`MAILGUN_SMTP_AUTH`, `MAILGUN_SMTP_PASS` and `MAILGUN_FROM_ADDRESS`
setup, transactional emails work out of the box in the Dev Container.
This commit is contained in:
Chris Raible 2024-10-28 16:14:04 -07:00 committed by GitHub
parent 75948c6d45
commit d0bf80b718
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -51,9 +51,10 @@ newConfig.adapters = {
// Only update the mail settings if they aren't already set
if (!originalConfig.mail && process.env.MAILGUN_SMTP_PASS && process.env.MAILGUN_SMTP_USER) {
if (!originalConfig.mail && process.env.MAILGUN_SMTP_PASS && process.env.MAILGUN_SMTP_USER && process.env.MAILGUN_FROM_ADDRESS) {
newConfig.mail = {
transport: 'SMTP',
from: process.env.MAILGUN_FROM_ADDRESS,
options: {
service: 'Mailgun',
host: 'smtp.mailgun.org',

View file

@ -14,6 +14,7 @@
"STRIPE_ACCOUNT_ID": "${localEnv:STRIPE_ACCOUNT_ID}",
"MAILGUN_SMTP_USER": "${localEnv:MAILGUN_SMTP_USER}",
"MAILGUN_SMTP_PASS": "${localEnv:MAILGUN_SMTP_PASS}",
"MAILGUN_FROM_ADDRESS": "${localEnv:MAILGUN_FROM_ADDRESS}",
"MAILGUN_API_KEY": "${localEnv:MAILGUN_API_KEY}",
"MAILGUN_DOMAIN": "${localEnv:MAILGUN_DOMAIN}"
},
@ -127,13 +128,17 @@
"description": "Your Mailgun account's SMTP password",
"documentationUrl": "https://app.mailgun.com/mg/sending/domains"
},
"MAILGUN_FROM_ADDRESS": {
"description": "The email address that will be used as the `from` address when sending emails via Mailgun",
"documentationUrl": "https://app.mailgun.com/mg/sending/domains"
},
"MAILGUN_API_KEY": {
"description": "Your Mailgun account's API key",
"documentationUrl": ""
"documentationUrl": "https://app.mailgun.com/mg/sending/domains"
},
"MAILGUN_DOMAIN": {
"description": "Your Mailgun account's domain, e.g. sandbox1234567890.mailgun.org",
"documentationUrl": ""
"documentationUrl": "https://app.mailgun.com/mg/sending/domains"
}
}
}