Closed achekulaev closed 6 months ago
Is this why when I install the mailhog addon it does not work by default?
Currently it sets:
sendmail_path /usr/local/bin/mhsendmail --smtp-addr=mail:1025
If I go into .docksal/addons/mailhog/conf/mailhog.ini
and change it to:
sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --read-envelope-from'
mailhog now works. I tested this on the edge and 2.x containers.
It my case it seems leaving this config in place is breaking the mailhog addon as the mhsendmail
command is not available in the cli images I am using.
I also found the following in `.docksal/etc/php/php.ini´:
; Mail settings
sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr=mail:1025'
When I commented this out and the sendmail_path line in .docksal/addons/mailhog/conf/mailhog.ini
the sendmail_path is set to:
sendmail_path /usr/bin/msmtp -t --host=mail --port=1025
which does not work. Looks like the --read-envelope-from
has to be there for it to work.
Looks like the --read-envelope-from has to be there for it to work.
@frederickjh yes, this has been already added in the edge versions of docksal/cli (develop
branch), but has not been yet released.
The mailhog addon should not be altering the php settings (for 2.x docksal/cli images).
However... it might be more reliable to to still let it set sendmail_path
to the value above, since projects using custom or modified stacks will likely be pinned at a particular and not the latest cli version.
. . . will likely be pinned at a particular and not the latest cli version.
How can one determine the version of a cli or other docksal container that a project is using?
After I started having this issue with MailHog, I changed the cli container version from cli:edge-php5.6
to cli:2-php5.6
to get the latest 2.x version, but if I wipe the mailhog directory in a Docksal project and reinstall it it is still adding the sendmail_path to the mhsendmail
binary not the msmtp
binary.
In other words when I install the MailHog addon into a project, .docksal/addons/mailhog/conf/mailhog.ini
contains:
; Mail settings
sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr=mail:1025'
not
; Mail settings
sendmail_path /usr/bin/msmtp -t --host=mail --port=1025 --read-envelope-from'
If I check the php info this is also what is being set for sendmail_path
.
The mailhog addon should not be altering the php settings (for 2.x docksal/cli images).
@frederickjh I meant that the addon is not supposed to do this, but that's what it's doing at the moment. It has to be updated and that's what this issue is about.
Until the mailhog
addon is updated, you can just follow the instructions in the docs to have MailHog added to your project stack: https://docs.docksal.io/tools/mailhog/#setup. It's just a few lines of code in docksal.yml
.
Glad to find this topic after 1,5 hour of searching / finding out why my e-mail service was not working. It seems that msmtp
was introduced in v2.6 (https://github.com/docksal/service-cli/pull/106).
In my scenario, the --read-envelope-from
did not work, so I've got my php set up like this:
sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --from=example'
For local development I don't care that much what the "from" is of my sent e-mails.
It would be nice to see this fixed though. Some PHP processes depend on the return value of mail()
, which is false
if msmtp does not manage to send an e-mail.
MailHog was replaced with Mailpit (https://github.com/docksal/addons/pull/95)
There will not be a need to alter php.ini with new cli:2.0 images