mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 08:45:54 +03:00
[GH-ISSUE #310] Allow the use of an environment variable to set the sendmail smtp address #204
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#204
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 @brammeleman on GitHub (Jun 7, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/310
Use case:
I'm testing software that mails to localhost:25 in production but in my test environment, I want to deliver to the mailpit container on port 1025.
Setting the
MH_SENDMAIL_SMTP_ADDRtomailpit:1025would enable me to leave the sendmail-using software identical.@axllent commented on GitHub (Jun 7, 2024):
If I understand correctly, you are wanting to use Mailpit's sendmail to route to another type of SMTP server eg: postfix or something (please confirm)?
@brammeleman commented on GitHub (Jun 10, 2024):
Mmm, I think I was a bit confused here. As a former mailhog (which shipped
mhsendmail) user, I assumed the mailpit sendmail binary was actually talking smtp to mailpit. But since sendmail is just another name/command of the mailpit binary itself, it doesn't make sense to have this environment variable.Sorry for this unnecessary issue! please close this issue..
ps: In the meantime, I'm using mailpit in the same container as my application for testing.
@axllent commented on GitHub (Jun 10, 2024):
Well, you're not wrong. Mailpit's sendmail implementation does use regular SMTP to talk to Mailpit, so it will technically work with any SMTP server. It is basically just another sendmail port (of sorts), as are the other dozen or so sendmail implementations commonly installed is systems. I'm just saying that this one was created specifically to communicate with Mailpit, and isn't extensively tested on anything other than Mailpit, so your mileage may vary.
@axllent commented on GitHub (Jun 10, 2024):
So to further my previous message, it sounds like this is exactly what you want to do - use Mailpit's sendmail to relay messages directly to a third party SMTP server. Provided that SMTP server does not require authentication, it should technically work. If this is what you want to achieve, then I can add support for an environment variable. Is this what you are still wanting after my explanation about its intended purpose?
@brammeleman commented on GitHub (Jun 10, 2024):
Let me explain my use case:
In one container:
go install github.com/mailhog/mhsendmail@9e70164f299c9e06af61402e636f5bbdf03e7dbb/usr/bin/sendmail) as /usr/sbin/sendmailMH_SENDMAIL_SMTP_ADDR=mail:1025The
mailcontainer runs mailpit.@axllent commented on GitHub (Jun 11, 2024):
So you're wanting to do this with Mailpit's sendmail too. There is already an undocumented
MP_SENDMAIL_SMTP_ADDR(eg:MP_SENDMAIL_SMTP_ADDR=mail:1025) variable you should be able to use. Please confirm if this works for you?@brammeleman commented on GitHub (Jun 11, 2024):
Great! This works and is exactly what I need ;-)
Could you add it to https://mailpit.axllent.org/docs/configuration/runtime-options/ ?
@axllent commented on GitHub (Jun 12, 2024):
I've added it now to the sendmail page rather than the runtime options as the runtime options are "server related" flags & environment variables 👍 Thanks for testing / confirming!
@brammeleman commented on GitHub (Jun 12, 2024):
Many thanks!