MailHog: Releasing mail doesn't work

There is another issue #246 which is gmail related. I’m having a similar problem but with a “regular” mail provider that I use for my websites.

My configuration:

Env variable MH_OUTGOING_SMTP is set to /test/mhout.json

The content of that file:

{
  "test1": {
    "name": "test1",
    "host": "smtp.example.com",
    "port": "465",
    "email": "myname@example.com",
    "username": "myname@example.com",
    "password": "mypassword",
    "mechanism": "PLAIN"
  }
}

When I’m releasing a mail I see this in the logs:

Releasing to myname@example.com (via smtp.example.com:465)
Found username/password, using auth mechanism: [PLAIN]

... after some time ...

Failed to release message: EOF

A connection to the server is possible, I’ve tried that. So I’m running out of ideas what to try next and hope you can help me.

About this issue

Most upvoted comments

You need to set -e MH_OUTGOING_SMTP=/config/smtp.json as an environment variable and then mount your host file into the docker container to that defined file, e.g. -v (path/to/myfile.json:/config/smtp.json and I guess you need to use priviledged network access for your docker container as well, otherwise sending emails will not be possible. However, that doesn’t sound like the similar problem that is discussed in this issue, it’s more about how to setup mailhog. This issue discusses the problem that emails can not be sent out over SSL when everything is configured already.