[GH-ISSUE #94] Enable as a service on linux #65

Closed
opened 2026-03-15 12:22:17 +03:00 by kerem · 4 comments
Owner

Originally created by @ameerElsherif on GitHub (Apr 19, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/94

How can I use mailpit as a service, so it can be enabled and automatically run with system start?
I am used to having this with Mailhog so, it is always running in the background.
So, I am not very comfortable having to run the command in a terminal every time I need to use mailpit.

Originally created by @ameerElsherif on GitHub (Apr 19, 2023). Original GitHub issue: https://github.com/axllent/mailpit/issues/94 How can I use mailpit as a service, so it can be enabled and automatically run with system start? I am used to having this with Mailhog so, it is always running in the background. So, I am not very comfortable having to run the command in a terminal every time I need to use mailpit.
kerem closed this issue 2026-03-15 12:22:23 +03:00
Author
Owner

@axllent commented on GitHub (Apr 19, 2023):

Hi. Can you please explain to me how you installed and are running MailHog on your system automatically? Did you follow some documentation to get this working, and if so, where did you see that documentation? Lastly, what system are you referring to, Windows, Linux or Mac?

<!-- gh-comment-id:1514128456 --> @axllent commented on GitHub (Apr 19, 2023): Hi. Can you please explain to me how you installed and are running MailHog on your system automatically? Did you follow some documentation to get this working, and if so, where did you see that documentation? Lastly, what system are you referring to, Windows, Linux or Mac?
Author
Owner

@ameerElsherif commented on GitHub (Apr 19, 2023):

Arch Linux
I installed Mailhog through AUR
Check: https://aur.archlinux.org/packages/mailhog-bin

<!-- gh-comment-id:1514421541 --> @ameerElsherif commented on GitHub (Apr 19, 2023): Arch Linux I installed Mailhog through AUR Check: https://aur.archlinux.org/packages/mailhog-bin
Author
Owner

@axllent commented on GitHub (Apr 19, 2023):

That appears to be specifically an Arch Linux package created for MailHog, and would include additional startup scripts designed for Arch. You will need to ask a maintainer (of Arch Linux packages) if they would be willing to include Mailpit in their packages. I do not know where you would ask that as I don't use Arch, but that site looks like a good starting point.

<!-- gh-comment-id:1514516039 --> @axllent commented on GitHub (Apr 19, 2023): That appears to be specifically an Arch Linux package created for MailHog, and would include additional startup scripts designed for Arch. You will need to ask a maintainer (of Arch Linux packages) if they would be willing to include Mailpit in their packages. I do not know where you would ask that as I don't use Arch, but that site looks like a good starting point.
Author
Owner

@ameerElsherif commented on GitHub (Apr 20, 2023):

For anyone interested in this, I ended up accomplishing it by creating a file with the following content:

[Unit]
Description=Mailpit
Documentation=https://github.com/axllent/mailpit
After=syslog.target network.target
AssertFileIsExecutable=/usr/local/bin/mailpit

[Service]
User=nobody
ExecStart=/usr/local/bin/mailpit
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target
  • You should change mailpit path if it is different than "/usr/local/bin/mailpit"
  • The location to save the file can be different for different systems you should lookup which path will work for you. For me on arch linux using systemd it was "/usr/lib/systemd/system/mailpit.service"

After creating the service file, run the following commands:
sudo systemctl start mailpit or sudo service mailpit start
sudo systemctl enable mailpit or sudo service mailpit enable

Done!

<!-- gh-comment-id:1515592242 --> @ameerElsherif commented on GitHub (Apr 20, 2023): For anyone interested in this, I ended up accomplishing it by creating a file with the following content: ``` [Unit] Description=Mailpit Documentation=https://github.com/axllent/mailpit After=syslog.target network.target AssertFileIsExecutable=/usr/local/bin/mailpit [Service] User=nobody ExecStart=/usr/local/bin/mailpit ExecReload=/bin/kill -USR2 $MAINPID [Install] WantedBy=multi-user.target ``` - You should change mailpit path if it is different than "/usr/local/bin/mailpit" - The location to save the file can be different for different systems you should lookup which path will work for you. For me on arch linux using systemd it was "/usr/lib/systemd/system/mailpit.service" After creating the service file, run the following commands: `sudo systemctl start mailpit` or `sudo service mailpit start` `sudo systemctl enable mailpit` or `sudo service mailpit enable` Done!
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#65
No description provided.