[GH-ISSUE #173] Feature request: Set auth credentials from env variables #115

Closed
opened 2026-03-15 12:39:44 +03:00 by kerem · 6 comments
Owner

Originally created by @Leny1337 on GitHub (Sep 27, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/173

Like in the topic - it could be great to provide login and password using env variables (separate for UI and SMTP).
For example:

MP_UI_AUTH_USER=admin
MP_UI_AUTH_PASSWORD=admin (in all supported formats)

In the code - if those variables are present, then do not use AUTH_FILE.

Originally created by @Leny1337 on GitHub (Sep 27, 2023). Original GitHub issue: https://github.com/axllent/mailpit/issues/173 Like in the topic - it could be great to provide login and password using env variables (separate for UI and SMTP). For example: ``` MP_UI_AUTH_USER=admin MP_UI_AUTH_PASSWORD=admin (in all supported formats) ``` In the code - if those variables are present, then do not use AUTH_FILE.
kerem 2026-03-15 12:39:44 +03:00
Author
Owner

@axllent commented on GitHub (Sep 27, 2023):

I'll see what I can do here 👍

<!-- gh-comment-id:1737930675 --> @axllent commented on GitHub (Sep 27, 2023): I'll see what I can do here 👍
Author
Owner

@ulken commented on GitHub (Sep 28, 2023):

This would align perfectly with my setup and make things easier on my end as well 👍 Let me know if I can help.

<!-- gh-comment-id:1739035204 --> @ulken commented on GitHub (Sep 28, 2023): This would align perfectly with my setup and make things easier on my end as well 👍 Let me know if I can help.
Author
Owner

@axllent commented on GitHub (Sep 29, 2023):

I have just released v1.9.4 which includes the ability to set both the web UI and SMTP credentials via the MP_UI_AUTH & MP_SMTP_AUTH environment variables. The credentials are a space-separated string with the exact same user1:password1 user2:password2 formats documented in the wiki. Obviously plain text passwords are not recommended :) Please have a test and let me know if this works for you? Thanks!

<!-- gh-comment-id:1740277618 --> @axllent commented on GitHub (Sep 29, 2023): I have just released v1.9.4 which includes the ability to set both the web UI and SMTP credentials via the `MP_UI_AUTH` & `MP_SMTP_AUTH` environment variables. The credentials are a space-separated string with the exact same `user1:password1 user2:password2` formats documented in [the wiki](https://github.com/axllent/mailpit/wiki/Basic-authentication). Obviously plain text passwords are not recommended :) Please have a test and let me know if this works for you? Thanks!
Author
Owner

@ulken commented on GitHub (Sep 29, 2023):

On fire 🔥

I'll give it a try later today and report back.

<!-- gh-comment-id:1740280697 --> @ulken commented on GitHub (Sep 29, 2023): On fire 🔥 I'll give it a try later today and report back.
Author
Owner

@ulken commented on GitHub (Oct 4, 2023):

Sorry for the late report. The weekend happened and then other things popped up (as they tend to do...). I started looking at it yesterday and then the deployment environment failed on me etc. etc.

Anyhow, I've now tested it with the UI and it worked flawlessly 👌

One thing: how do you sign out? 😅 Clear cookies/local storage?

<!-- gh-comment-id:1746312762 --> @ulken commented on GitHub (Oct 4, 2023): Sorry for the late report. The weekend happened and then other things popped up (as they tend to do...). I started looking at it yesterday and then the deployment environment failed on me etc. etc. Anyhow, I've now tested it with the UI and it worked flawlessly 👌 One thing: how do you sign out? 😅 Clear cookies/local storage?
Author
Owner

@axllent commented on GitHub (Oct 4, 2023):

That's great news (that it's working, not deployment failures lol). It's basic auth, you don't log out, you just close your browser. That's about it, nothing special, no cookies. There is localstorage which is just some preferences, but not credentials.

I'm closing this issue as it appears to have resolved the original request 👍

<!-- gh-comment-id:1746385112 --> @axllent commented on GitHub (Oct 4, 2023): That's great news (that it's working, not deployment failures lol). It's basic auth, you don't log out, you just close your browser. That's about it, nothing special, no cookies. There is localstorage which is just some preferences, but not credentials. I'm closing this issue as it appears to have resolved the original request 👍
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#115
No description provided.