Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailhog + php fails with: "unknown shorthand flag: 'o' in -oi" #614

Closed
pnoeric opened this issue Jul 25, 2019 · 6 comments
Closed

Mailhog + php fails with: "unknown shorthand flag: 'o' in -oi" #614

pnoeric opened this issue Jul 25, 2019 · 6 comments
Assignees

Comments

@pnoeric
Copy link
Contributor

pnoeric commented Jul 25, 2019

Hi, I've installed Mailhog per the instructions and it's working great (I can see it at localhost:8025 and send messages from the command line). However, the alias for sendmail that should override php and let the mail() function use mailhog is not working.

First, when I go into the shell and test mailhog, this works perfectly:

/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025" test@mailhog.local <<EOF
From: App <app@mailhog.local>
To: Test <test@mailhog.local>
Subject: Test message

Some content!
EOF

After I execute that, I can see the message at localhost:8025. All good there.

However, my php app fails with:

unknown shorthand flag: 'o' in -oi
Usage of /usr/local/bin/mhsendmail:
  -f, --from="nobody@php": SMTP sender
      --smtp-addr="localhost:1025": SMTP server address
Message could not be sent. Mailer Error: Could not execute: /usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"

No idea what the '-o' flag is, but it appears to be passed from php to mhsendmail where it fails.

I did see that mhsendmail's most recent commit says: Added -o option for compatibility

That was back in 2017. Could it be that an old version of mhsendmail is included with devilbox? I might try to figure out how I can update mhsendmail inside the box... hmmm...

FWIW I confirmed that I have the latest version of devilbox too:

# git pull origin master
From https://github.com/cytopia/devilbox
 * branch              master     -> FETCH_HEAD
Already up to date.

# git describe --tags
v1.0.2-6-g0543f2da
@pnoeric pnoeric added the bug label Jul 25, 2019
@pnoeric pnoeric changed the title Mailhog installed correctly but php fails - unknown shorthand flag: 'o' in -oi Mailhog installed correctly but php fails "unknown shorthand flag: 'o' in -oi" Jul 25, 2019
@pnoeric
Copy link
Contributor Author

pnoeric commented Jul 25, 2019

Yeah, here's the sendmail flag that php appears to be passing:
image

Then I discovered that the latest official release of mhsendmail was in 2016, BEFORE they added support for the -oi flag.

So it seems I need to build the latest mhsendmail from source. I tried to do that (following this thread) but no luck, since I don't have the go compiler inside devilbox, nor apt-get.

Ok, now I'm stuck. ;-)

@pnoeric pnoeric changed the title Mailhog installed correctly but php fails "unknown shorthand flag: 'o' in -oi" Mailhog installed ok but fails "unknown shorthand flag: 'o' in -oi" Jul 25, 2019
@pnoeric pnoeric changed the title Mailhog installed ok but fails "unknown shorthand flag: 'o' in -oi" Mailhog fails "unknown shorthand flag: 'o' in -oi" Jul 25, 2019
@pnoeric pnoeric changed the title Mailhog fails "unknown shorthand flag: 'o' in -oi" Mailhog + php fails with: "unknown shorthand flag: 'o' in -oi" Jul 25, 2019
@Tuurlijk
Copy link

Try installing the mhsendmail binary you want like: https://github.com/Tuurlijk/docker-php-fpm/blob/master/7.2/php/Dockerfile#L36

@stale
Copy link

stale bot commented Oct 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue:stale This issue has become stale and is marked for auto-close label Oct 24, 2019
@stale stale bot closed this as completed Oct 31, 2019
@cytopia cytopia reopened this Nov 17, 2019
@stale stale bot removed the issue:stale This issue has become stale and is marked for auto-close label Nov 17, 2019
@cytopia cytopia added the email label Dec 31, 2019
@cytopia cytopia self-assigned this Dec 31, 2019
@cytopia
Copy link
Owner

cytopia commented Dec 31, 2019

@pnoeric will be addressed here: devilbox/docker-php-fpm#143

@cytopia cytopia mentioned this issue Dec 31, 2019
4 tasks
@cytopia cytopia closed this as completed in 72c7a7d Jan 2, 2020
@cytopia
Copy link
Owner

cytopia commented Jan 2, 2020

FYI: The new version of mhsendmail now supports those flags.

@pnoeric
Copy link
Contributor Author

pnoeric commented Jan 4, 2020

@cytopia thank you! 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants