phpemaildocksal

How should I setup Mailhog to work with Docksal?


I have follow official documentation on https://docs.docksal.io/tools/mailhog/ But can not get mails on mailhog. In logs (fin logs -f cli) I have:

WARNING: [pool www] child 49 said into stderr: "sh: 1: /usr/local/bin/mhsendmail: not found"

My docksal.yml:

version: "2.1"
services:
mail:
  extends:
    file: ${HOME}/.docksal/stacks/services.yml
    service: mail

My script (test.php):

var_dump(mail('ds@test.com', 'test', 'test', 'From: d@test.com' . "\r\n", '-f d@test.com'));

always returns bool(false) and no mails in the mailhog dashboard. What could be wrong?


Solution

  • The cause of the error is a line

    sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr=mail:1025'
    

    in project/.docksal/etc/php/php.ini

    Need to delete it and everything is OK.

    PS. Seems it comes from

    fin addon install mailhog
    

    command.