How do I use mailgun with docker-compose?

#1

Error sending email! Error sending email: Failed to send email. Reason: connect ECONNREFUSED 127.0.0.1:25. Please check your email settings and resend the invitation.

I get this error. I have the following in my docker-compose.yml file:

environment:
  url: https://thedailyshitter.com
  mail__transport: SMTP
  mail__options__service: Mailgun
  mail__options__auth__user: postmaster@mail.profullstack.com
  mail__options__auth__pass: 'abc'

I do not know where the source files are so all I have is this docker-compose.yml file.

#2

Hey I’m not sure about docker-compose but the ghost file that would have the mail settings is located at the root of your ghost directory if you are not sure where that is you can use the command ghost ls and it will tell you you will need to edit config.production.json you will need to change the following:

  "mail": {
    "transport": "Direct"
  },

to the following.

  "mail": {
    "from": "'Ghost Server' <ghost@self.mutahar.me>",
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "smtp.mailgun.org",
      "port": 465,
      "secureConnection": true,
      "auth": {
        "user": "postmaster@mail.profullstack.com",
        "pass": "P@ssw0rd"
      }
    }
  },

After you have changed the settings you will need to restart ghost using ghost restart while you are in the ghost directory. Now you can try to send email.

Note: I’m not sure about docker-compose.yml if you should change it back or leave it as-is since I have ghost installed without docker. If sending email doesn’t work maybe try to revert the file.

Let me know if it work

#3

I’m using the docker image hosted on docker hub so I don’t actually have access to source files

closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.