docksal / addons

Community driven, submit your addon! Docksal addons that can be installed via `fin addon install` command.
MIT License
16 stars 34 forks source link

Update Mailhog for new cli:2.0 images #6

Closed achekulaev closed 6 months ago

achekulaev commented 6 years ago

There will not be a need to alter php.ini with new cli:2.0 images

frederickjh commented 5 years 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.

frederickjh commented 5 years ago

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.

frederickjh commented 5 years ago

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.

lmakarov commented 5 years ago

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.

https://github.com/docksal/service-cli/blob/233ccda1d907c5104a6d4dedbea18f096682438e/7.2/config/php/zz-php.ini#L13

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.

frederickjh commented 5 years ago

. . . 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.

frederickjh commented 5 years ago

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.

lmakarov commented 5 years ago

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.

kanduvisla commented 4 years ago

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.

lmakarov commented 6 months ago

MailHog was replaced with Mailpit (https://github.com/docksal/addons/pull/95)