2

I am using Docker4drupal, a preconfigured set of docker containers.

One of the containers is the mailhog tool.

Docker4drupal is configured to use mailhog as email sender so it captures all mail sent for developing purposes. This is great but I would to allow some emails to pass through.

How can I bypass mailhog for certain emails?

I can think on those approaches:

  1. Temporary reconfigure docker4drupal to use an smtp server.
  2. Make mailhog forward emails using an smtp server.

I don't know how to accomplish any of them. How can I do this? I there any other better approach?

Edu
  • 23
  • 2

1 Answers1

2

Mailhog's documentation describes how to set it up to release emails to an SMTP server.

In short, you need to set the environment variable MH_OUTGOING_SMTP to contain a JSON object which points to the SMTP server(s) you want to release the message to:

{
    "server name": {
        "name": "server name",
        "host": "...",
        "port": "587",
        "email": "...",
        "username": "...",
        "password": "...",
        "mechanism": "PLAIN"
    }
}

Note that in this configuration you still need to manually "release" the messages in the mailhog interface. I don't think there is a way to tell it something like "auto-release all messages that are being sent to me@example.com" or similar.

Moshe Katz
  • 3,053
  • 3
  • 26
  • 41
  • The problem was that I was using gmail smtp server but the ssl port 465, using the 587 port it's working. so thank you for the clue. – Edu Jun 21 '19 at 08:29