mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 08:45:54 +03:00
[GH-ISSUE #14] Need assistance in using mailpit in our app #11
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @N6REJ on GitHub (Sep 19, 2022).
Original GitHub issue: https://github.com/axllent/mailpit/issues/14
Hello;
We're trying to move away from mailhog and instead use mailpit in our wamp stack but are running into an issue where the service doesn't start. I suspect it has something to do with this line
github.com/Bearsampp/Bearsampp@99c82d0152/core/classes/bins/class.bin.mailpit.php (L6)we're not php pro's so this is a bit of a daunting task for us.
We're the only 100% portable WAMP stack that I'm aware of so I'd really like to support this exposure of this project by adding mailpit to our software.
Perhaps someone here could lend some guidance?
Thanks in advance
Bear
p.s. here's our config for mailpit
https://github.com/Bearsampp/module-mailpit/blob/main/bin/mailpit1.1.5/bearsampp.conf
@axllent commented on GitHub (Sep 19, 2022):
Hi @N6REJ. I think you're quite right, the command line flags that are being passed through to Mailpit aren't compatible as they are specific to MailHog. It's worth nothing that Mailpit is not a drop-in replacement for MailHog but a replacement for it. Please note that I do not know what your requirements for your WAMP stack are, however I suspect just a listening SMTP port and email capture/viewing via a web UI? If so then you're on the right track.
-hostname localhost -api-bind-addr 127.0.0.1:%d -ui-bind-addr 127.0.0.1:%d -smtp-bind-addr 127.0.0.1:%d -storage maildir -maildir-path "%s"should probably be something like (untested):
--listen 127.0.0.1:%d --smtp 127.0.0.1:%d --db-file "%s/mailpit.db"The command line flags are documented in the wiki if you need more information.
@N6REJ commented on GitHub (Sep 20, 2022):
They have the ability to change ports if they desire.
i'm thinking here they should only have the option for listen and smtp?
This is the old method here...
@N6REJ commented on GitHub (Sep 20, 2022):
Also, do you have a logo? just an fyi, we will be ... advertising?.... stating anyway, that we use mailpit so hopefully will gain you some users
@N6REJ commented on GitHub (Sep 20, 2022):
still doing something wrong.

after a few capitalization changes it now says

but it shouldn't be paused
@N6REJ commented on GitHub (Sep 20, 2022):
I checked the error log and we get
@axllent commented on GitHub (Sep 20, 2022):
It looks to me as if incomplete flags / arguments are being passed to Mailpit, however I don't know Bearsampp at all so you really should be asking one of their team how to do it. The only direction I can give you is to try Mailpit on the commandline to get the correct flags and arguments, and then modify the PHP script accordingly. Mailpit should be working as expected on Windows as I've tested this myself.
Is there a way to print out the "final command" (as in what the PHP script is actually trying to run)?
@N6REJ commented on GitHub (Sep 20, 2022):
We are the team thats developing it. Ergo our struggles.

when we do a --help this is what we see
I'll have to see if there is a way to actually dump the output.
@axllent commented on GitHub (Sep 20, 2022):
Ahh, that makes more sense to me now. The help you are getting is for the built in sendmail functionality, this means that the Mailpit command your are running isn't executing the binary directly, but rather a link to the binary.
When run, Mailpit detects if the command is executing a symlink, and if so switches to sendmail. This allows a developer to easily substitute the systems sendmail binary with just a symlink.
Can you please tell me what happens when your script runs prior to executing? Does it extract Mailpit and then link to it first? If so, can you provide me more information on what that link is called, etc?
@axllent commented on GitHub (Sep 20, 2022):
Actually I'm starting to wonder if for instance you're running it as just "mailpit" in your script (the windows binary is called "mailpit.exe"), or potentially "Mailpit.exe" etc. If the command run does not exactly match (1:1) the binary name then it invokes sendmail.
I should probably relax the rules on the name matching (specifically for Windows as it doesn't distinguish letter casing, and the command can ignore
.exein the executable name when the binary is in your current directory or $PATH), however it would be very helpful to me to know a few more details from you. If you ran the above command asmailpit.exe --helpyou should get a different help screen.@N6REJ commented on GitHub (Sep 21, 2022):
yes, its totally different.

I'll look over the code tonight and see what I can dig up. The main problem right now is nssm or winbinder is not actually creating it as a service.
@axllent commented on GitHub (Sep 21, 2022):
That explains it, thanks - your script is currently invoking it as "mailpit" whereas the actual executable file is "mailpit.exe", so Mailpit is automatically assuming it's a symlink, so it's invoking the sendmail functionality.
I will push an update in a few hours that should fix that for Windows, and which hopefully gets you a step further to integrating Mailpit in your software. I'd say that the reason it's not currently able to set it up as a service is that Mailpit is currently returning an error when you try start it.
@N6REJ commented on GitHub (Sep 21, 2022):
that would be great.. tyvm! I'm pulling my hair out trying to make heads/tails over why its being a brat LOL.
@axllent commented on GitHub (Sep 21, 2022):
I've released 1.1.7 which hopefully solves your issue - or at least gets you to your next step.
As for your PHP, all references to apiPort can be removed (there is no API port configuration fro Mailpit, in fact it doesn't have an API like MailHog does). There is however one section that references the apiPort, which may or may not be substitution, so tread lightly.
@N6REJ commented on GitHub (Sep 21, 2022):
I think we're getting closer...
When I check the log after it says it can't start the service I see...
Which is in here.
github.com/Bearsampp/Bearsampp@da154a05c6/core/classes/bins/class.bin.mailpit.php (L29-L46)Just as an fyi. When the program "loads" it creates a "current" folder which is an exact copy of the current version that supposed to be running. This is due to us supporting multiple version of programs.

php is a good example. They might want php8.0 one moment and php 8.1.9 the next. So when they change versions, it calls a reload function that replaces "current" with the new version if that makes sense.
so, the mailpit that will be loaded/executed will live here
@axllent commented on GitHub (Sep 21, 2022):
@N6REJ I really don't think I can help you here, as the issue appears to be related to your scripts. From what I can see (in your message), I think the line
Bearsampp 2022.09.01 # ERROR: Invalid parameter 'mailpitUiPort' : 0(which is coming from here) may be the key. I think your scripts are returning an error before it even tries to run the binary. It looks to me like your scripts aren't interpreting your configuration file correctly.Again, if it is actually running Mailpit, we need to know what the actual command is (that it is executing).
@N6REJ commented on GitHub (Sep 21, 2022):
the ui was my stupid typo error.

I do have good news though.. the program no longer locks up when running.
I still get the error
I don't think its actually running mailpit yet.
The only error I'm seeing ( after starting dev mode log reporting ) is
@N6REJ commented on GitHub (Sep 21, 2022):
The one spot that perhaps you can help with.. is the ajax routine.
https://github.com/Bearsampp/Bearsampp/blob/mailpit/core/resources/homepage/ajax/ajax.mailpit.php
with mailhog it worked in 7.4.30 but NOT 8.x+
right this minute it breaks all ajax functions in the dashboard.
I don't know if its related to the service issues.
@N6REJ commented on GitHub (Sep 21, 2022):
@axllent I think I found what you've been asking for.
bearsampp-nssm.log
I couldn't see this before I turned on dev logging.
@axllent commented on GitHub (Sep 21, 2022):
The short answer is I don't know. It looks OK to me (the flags & args being passed to it), but you're asking me to debug your application, but I have no idea at all how your application actually works. This includes the SMTP check (ajax script) - I can only assume it checks a TCP port if its open, but I have no way of telling if that checking functionality works, so I can't tell, sorry. I also do not know what "the service is paused" means - what is paused exactly? Mailpit doesn't pause, so either it's something in your application that is paused, or the error reported by your application is wrong. I really don't mean to sound rude, but I don't see how I can help you without learning how your entire system works (which I don't have time or energy to do unfortunately).
http://localhost:8025/ should work if Mailpit is running (assuming Mailpit is running on the host and not in a docker container or similar).
@N6REJ commented on GitHub (Sep 21, 2022):
ok.. ty for your time. you've been more then gracious.
@axllent commented on GitHub (Sep 22, 2022):
No problem and good luck! If you need Mailpit support then please feel free to submit a new issue 👍