Mailhog ERR_CONNECTION_REFUSED & Could not instantiate mail function

Hi there,

For some reason Mailhog is not working for me in development. First time this happens.
Yes I have SSL enabled locally and yes I added the hsts_max_age parameter like stated in the docs and re-reprovisioned my local VM.

I also cleared the hsts cache in my browser for the domain, but I just keep getting a



Also Gravityforms gives me a warning:

WordPress was unable to send the notification email. Could not instantiate mail function.

So I verified my sSMTP credentials on staging and I can send emails from there with these.
Then I ssh’d into my dev VM and I noticed sSMTP is not installed, is this normal behaviour?

What else could be happening?
Maybe related; this is my first project on my M1 Macbook Pro with Parallels Pro.


I think there’s still an unsolved issue about Mailhog on ARM: Trellis and Apple Silicon · Issue #1253 · roots/trellis · GitHub

I’m going to assume that if you haven’t manually done this workaround, then that’s the first thing to investigate.

1 Like

Ah check, did not see that post before!
Presumably I have to set that here:


Just put these two lines in group_vars/development/all.yml:

mailhog_binary_url: ""
mhsendmail_binary_url: ""

Jup, that was it! I did have to destroy my VM though.
Thing is, my colleague doesn’t have a M1 chip, so if he would re-provision his VM, Mailhog won’t work for him. Is there a way to add these lines conditionally based upon your arch?

Good question…

Normally you could create files with the architecture name and dynamically include them:

- include_vars: "{{ ansible_architecture }}.yml"

But since the mailhog role is vendored it makes it harder. Maybe you could just add that include_vars at the top in the dev.yml playbook.

I know the x86 arch is x86_64, you’d have to find what the ARM one is.

Thanks, that helped!
I put this at the top of my dev.yml:

- hosts: all
    - debug:
        msg: "{{ ansible_architecture }}"
    - name: Include architecture specific ansible vars
        file: "{{ item }}"
        - files:
          - "{{ ansible_architecture }}.yml"
          skip: true
          errors: ignore

This will include my local aarch64.yml file with my ARM vars:

mailhog_binary_url: ""
mhsendmail_binary_url: ""
1 Like