### Install Node.js Modules for UI Source: https://mailpit.axllent.org/docs/install/source Install the necessary Node.js modules for building the Mailpit web user interface. This requires Node.js and npm to be installed. ```bash npm install ``` -------------------------------- ### Install and Build JavaScript Assets Source: https://mailpit.axllent.org/docs/development/getting-started Run these commands in the top-level project folder to install Node.js dependencies and compile frontend assets. ```bash npm install npm run build ``` -------------------------------- ### Install Mailpit with GitHub Token Source: https://mailpit.axllent.org/docs/install Installs Mailpit using a GitHub token for authentication. Requires sudo privileges. ```bash sudo GITHUB_TOKEN="your_token_here" sh < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh) ``` -------------------------------- ### Install Mailpit with Custom Path Source: https://mailpit.axllent.org/docs/install Installs Mailpit to a specified path using the INSTALL_PATH environment variable. Requires sudo privileges. ```bash sudo INSTALL_PATH=/usr/bin sh < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh) ``` -------------------------------- ### Plain Text Password File Example Source: https://mailpit.axllent.org/docs/configuration/passwords Illustrates the format for a plain text password file, where usernames are followed by their plain text passwords. ```plaintext user1:password1 user2:password2 ``` -------------------------------- ### Install Mailpit via Script (Linux & Mac) Source: https://mailpit.axllent.org/docs/install Installs Mailpit to /usr/local/bin/mailpit. Ensure you have curl and sudo privileges. ```bash sudo sh < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh) ``` -------------------------------- ### Start Mailpit systemd Service Source: https://mailpit.axllent.org/docs/install/systemd Starts the Mailpit service immediately. This command is used after enabling the service or to manually start it. ```bash systemctl start mailpit.service ``` -------------------------------- ### Run Mailpit from Source Source: https://mailpit.axllent.org/docs/development/getting-started Execute this command in the project folder to run the Mailpit application directly. Arguments can be appended, for example: `go run . -h`. ```bash go run . ``` -------------------------------- ### Override From Example Source: https://mailpit.axllent.org/docs/configuration/smtp-relay Demonstrates how setting the `override-from` option changes the 'From' email address while preserving the original sender in an 'X-Original-From' header. ```email From: "Original Recipient" X-Original-From: original@example.com From: "Original Recipient" ``` -------------------------------- ### Encrypted Password File Example Source: https://mailpit.axllent.org/docs/configuration/passwords Shows an example of an encrypted password file using the APR1Crypt format. Use online tools to generate encrypted passwords. ```plaintext user1:$apr1$rja5hy8u$0DN2pENpLk1d4BqgPEho61 user2:$apr1$asfohhn3$WXNtWWEnCMRFkI75J3exy1 ``` -------------------------------- ### Email Header Transformation Example Source: https://mailpit.axllent.org/docs/configuration/smtp-forward Illustrates how the 'override-from' setting transforms email headers. The original 'From' address is preserved in 'X-Original-From', and the 'From' header is updated to the specified address. ```text From: "Original Recipient" ``` ```text X-Original-From: original@example.com From: "Original Recipient" ``` -------------------------------- ### Example X-Tags Header Source: https://mailpit.axllent.org/docs/usage/tagging Add a comma-separated list of tags to the X-Tags header in your email to have Mailpit automatically apply them. ```email X-Tags: Tag 1, Tag 2, hostname ``` -------------------------------- ### Enable Mailpit systemd Service Source: https://mailpit.axllent.org/docs/install/systemd Enables the Mailpit service to start automatically on system boot. This command creates a symbolic link for the systemd manager. ```bash systemctl enable mailpit.service ``` -------------------------------- ### Run Basic Mailpit Docker Container Source: https://mailpit.axllent.org/docs/install/docker Starts a Mailpit container in detached mode with automatic restart. Ensure ports 8025 (Web UI) and 1025 (SMTP) are mapped. ```bash docker run -d \ --restart unless-stopped \ --name=mailpit \ -p 8025:8025 \ -p 1025:1025 \ axllent/mailpit ``` -------------------------------- ### Docker Compose Example for Mailpit Source: https://mailpit.axllent.org/docs/install/docker Defines a Mailpit service for Docker Compose, exposing web UI and SMTP ports. It also configures persistent storage, database path, and specific SMTP/UI settings. ```yaml services: mailpit: image: axllent/mailpit container_name: mailpit restart: unless-stopped volumes: - ./data:/data ports: - 8025:8025 - 1025:1025 environment: MP_MAX_MESSAGES: 5000 MP_DATABASE: /data/mailpit.db MP_SMTP_AUTH_ACCEPT_ANY: 1 MP_SMTP_AUTH_ALLOW_INSECURE: 1 ``` -------------------------------- ### Clone Mailpit Repository Source: https://mailpit.axllent.org/docs/install/source Clone the Mailpit repository from GitHub. Ensure you have Git installed. ```bash git clone git@github.com:axllent/mailpit.git cd mailpit ``` -------------------------------- ### Enable SpamAssassin with IP:Port Flag Source: https://mailpit.axllent.org/docs/configuration/spamassassin Use this flag when starting Mailpit to connect to a self-hosted SpamAssassin instance. Replace with the actual IP address and port of your SpamAssassin service. ```bash --enable-spamassassin ``` -------------------------------- ### Enable Chaos with Custom Triggers Source: https://mailpit.axllent.org/docs/integration/chaos Configure Chaos triggers and their probabilities directly when starting Mailpit using the `--chaos-triggers` flag or `MP_CHAOS_TRIGGERS` environment variable. The format is `::`, separated by commas. ```bash --chaos-triggers Sender:451:50,Recipients:451:50 ``` ```bash MP_CHAOS_TRIGGERS=Sender:451:50,Recipients:451:50 ``` ```bash --chaos-triggers Sender:451:100 ``` -------------------------------- ### Enable SMTP with STARTTLS Source: https://mailpit.axllent.org/docs/configuration/smtp Provide a TLS certificate and key to enable STARTTLS. This allows for both plain text and encrypted connections. ```bash mailpit --smtp-tls-cert /path/to/cert.pem --smtp-tls-key /path/to/key.pem ``` -------------------------------- ### Create a test email file Source: https://mailpit.axllent.org/docs/install/testing Create a text file with email headers and body content for testing. ```text From: sender@example.com To: recipient@example.com Subject: Email Subject This is the body of the email. It can contain multiple lines of text. ``` -------------------------------- ### Enable HTTPS for UI and API Source: https://mailpit.axllent.org/docs/configuration/http Provide Mailpit with an SSL certificate and private key to enable HTTPS. Ensure both files are provided. ```bash mailpit --ui-tls-cert /path/to/cert.pem --ui-tls-key /path/to/key.pem ``` -------------------------------- ### Add Basic Authentication for UI and API Source: https://mailpit.axllent.org/docs/configuration/http Configure basic authentication for the web UI and API by specifying a password file. Alternatively, use the MP_UI_AUTH_FILE environment variable. ```bash mailpit --ui-auth-file /path/to/password-file ``` -------------------------------- ### Enable Prometheus Metrics (Integrated Mode) Source: https://mailpit.axllent.org/docs/configuration/prometheus Enable Prometheus metrics to be served on the main web UI port. This inherits existing configuration like TLS and authentication. Metrics will be available at the /metrics endpoint. ```bash # Using command line flag mailpit --enable-prometheus true # Using environment variable export MP_ENABLE_PROMETHEUS=true mailpit ``` -------------------------------- ### Enable POP3 Server with Authentication Source: https://mailpit.axllent.org/docs/configuration/pop3 Use this command to run Mailpit with the POP3 server enabled and requiring authentication via a password file. Ensure the specified file exists and contains valid credentials. ```bash mailpit --pop3-auth-file /path/to/password-file ``` -------------------------------- ### Detecting New Messages via Websocket Source: https://mailpit.axllent.org/docs/api-v1/websocket Example of a 'new' message type broadcasted by the websocket, containing a summary of a received email. Filter for 'Type': 'new' to process these. ```json { "Type": "new", "Data": { "ID": "YsABjkFERuPyq8XC6WaKs2", "MessageID": "LDBnLCzbh3LQGbHb6d2B8H@mailpit", "Read": false, "From": { "Name": "Mailpit", "Address": "mailpit@example.com" }, "To": [ { "Name": "Test user", "Address": "test@example.com" } ], "Cc": [], "Bcc": [ { "Name": "", "Address": "test@test" } ], "ReplyTo": [], "Subject": "Hello from Mailpit SMTP API!", "Created": "2025-03-08T23:58:34.665934146+13:00", "Tags": [], "Size": 935, "Attachments": 0, "Snippet": "Mailpit is a small, fast, low memory, zero-dependency, multi-platform email testing tool \u0026 API for developers." } } ``` -------------------------------- ### Enable Prometheus Metrics (Separate Server Mode) Source: https://mailpit.axllent.org/docs/configuration/prometheus Run a dedicated metrics server on a custom port for Prometheus. This mode does not use TLS or authentication. ```bash # Custom listen address for separate server mailpit --enable-prometheus 0.0.0.0:9091 # Using environment variable export MP_ENABLE_PROMETHEUS="0.0.0.0:9091" mailpit ``` -------------------------------- ### Configure Mailpit as a Supervisor Service Source: https://mailpit.axllent.org/docs/install/supervisor Create a supervisor service configuration file for Mailpit. Ensure the user running the service has read/write permissions for the database store. ```ini [program:mailpit] [Service] command=/usr/local/bin/mailpit -d /var/lib/mailpit/mailpit.db user=mailpit numprocs=1 startsecs=0 autostart=true autorestart=true startretries=10 process_name=%(program_name)s_%(process_num)02d # define your environments # environment=MP_SMTP_RELAY_HOST="/path/to/your/smtp-relay.conf",MP_SMTP_RELAY_PORT="587" ``` -------------------------------- ### Configure SMTP authentication with a password file Source: https://mailpit.axllent.org/docs/configuration/smtp Set up SMTP authentication by providing a file containing usernames and passwords. Mailpit supports PLAIN and LOGIN mechanisms. ```bash mailpit --smtp-auth-file ``` -------------------------------- ### Nginx Reverse Proxy Configuration for Mailpit Unix Socket Source: https://mailpit.axllent.org/docs/configuration/unix-domain-sockets Configure Nginx to proxy requests to the Mailpit HTTP Unix domain socket. This setup requires enabling websocket support. ```nginx server { listen 80; server_name localhost; location / { proxy_pass http://unix:/var/run/mailpit/http.sock; # enable the websocket proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } } ``` -------------------------------- ### Configure Send API Authentication via Environment Variables Source: https://mailpit.axllent.org/docs/configuration/http Set send API endpoint authentication using environment variables. Options include specifying a password file, providing credentials directly, or accepting any credentials. ```bash # Set dedicated send API endpoint credentials MP_SEND_API_AUTH_FILE=/path/to/send-api-password-file # Or provide credentials directly (space-separated list) MP_SEND_API_AUTH="senduser1:password1 senduser2:password2" # Or accept any credentials for Send API MP_SEND_API_AUTH_ACCEPT_ANY=true ``` -------------------------------- ### Generate Swagger Spec with Docker Source: https://mailpit.axllent.org/docs/development/swagger Use this Docker command to generate the Swagger spec file. Ensure you are in the project's root directory. The command mounts the current directory into the Docker container and executes the go-swagger generate spec command. ```bash docker run --rm -it \ -u $(shell id -u):$(shell id -g) \ -v "${PWD}:/source" \ axllent/go-swagger generate spec -m -i ./server/apiv1/swagger-config.yml \ -o ./server/ui/api/v1/swagger.json ``` -------------------------------- ### Configure Mailpit to Listen on Unix Sockets Source: https://mailpit.axllent.org/docs/configuration/unix-domain-sockets Use the `--listen` flag to specify Unix domain sockets for both HTTP and SMTP servers. The format is `unix::`. Ensure the parent directory has appropriate permissions. ```bash mailpit --listen unix:/var/run/mailpit/http.sock:666 --smtp unix:/var/run/mailpit/smtp.sock:666 ``` -------------------------------- ### Run Mailpit Docker Container with Options Source: https://mailpit.axllent.org/docs/install/docker Configures Mailpit with persistent data storage, authentication file, and timezone. Environment variables are set using the -e flag. ```bash docker run -d \ --name=mailpit \ --restart unless-stopped \ -v /path/to/mailpit-data:/data \ -e MP_DATABASE=/data/mailpit.db \ -e MP_UI_AUTH_FILE=/data/authfile \ -e TZ=Europe/London \ -p 8025:8025 \ -p 1025:1025 \ axllent/mailpit ``` -------------------------------- ### Enable SpamAssassin with Postmark Service Environment Variable Source: https://mailpit.axllent.org/docs/configuration/spamassassin Set this environment variable to integrate with the Postmark service. This option does not require specifying a port. ```bash MP_ENABLE_SPAMASSASSIN=postmark ``` -------------------------------- ### Create Mailpit systemd Service File Source: https://mailpit.axllent.org/docs/install/systemd This configuration file defines the Mailpit service for systemd. It specifies the executable path, restart behavior, logging identifier, and the user/group to run the service as. Ensure the database path is writable by the specified user. ```systemd [Unit] Description=Mailpit server [Service] ExecStart=/usr/local/bin/mailpit -d /var/lib/mailpit/mailpit.db Restart=always # Restart service after 10 seconds if service crashes RestartSec=10 SyslogIdentifier=mailpit User=mailpit Group=mailpit [Install] WantedBy=multi-user.target ``` -------------------------------- ### Configure system sendmail to use Mailpit Source: https://mailpit.axllent.org/docs/install/sendmail Route emails through your system's `sendmail` binary to Mailpit's SMTP server on port 1025. Adjust the host and port if necessary. ```bash /usr/sbin/sendmail -S localhost:1025 -t ``` -------------------------------- ### Send test email using system sendmail Source: https://mailpit.axllent.org/docs/install/testing If using a system-installed sendmail, use this command to send a test email. ```bash sendmail -t -S localhost:1025 < email.txt ``` -------------------------------- ### Build Mailpit Web UI Source: https://mailpit.axllent.org/docs/install/source Compile the Mailpit web user interface assets (HTML, CSS, JS). Use `npm run watch` for automatic rebuilding on changes, but note that Mailpit must be restarted and the browser refreshed to see updates. ```bash npm run build ``` -------------------------------- ### Send test email using mailpit sendmail Source: https://mailpit.axllent.org/docs/install/testing Use the `mailpit sendmail` command to send a test email from a file. ```bash mailpit sendmail < email.txt ``` -------------------------------- ### Enable SpamAssassin with IP:Port Environment Variable Source: https://mailpit.axllent.org/docs/configuration/spamassassin Set this environment variable to enable SpamAssassin integration with a self-hosted instance. Ensure matches your SpamAssassin service's address. ```bash MP_ENABLE_SPAMASSASSIN= ``` -------------------------------- ### Enable POP3 Server with SSL/TLS Encryption Source: https://mailpit.axllent.org/docs/configuration/pop3 Configure the POP3 server to use SSL/TLS encryption by providing paths to your certificate and key files. This command also enables authentication. ```bash mailpit \ --pop3-auth-file /path/to/password-file \ --pop3-tls-cert /path/to/cert.pem \ --pop3-tls-key /path/to/key.pem ``` -------------------------------- ### Build Mailpit Binary Source: https://mailpit.axllent.org/docs/install/source Compile the main Mailpit binary after building the UI assets. This command uses Go build flags to strip debugging information and symbols. ```bash go build -ldflags "-s -w" ``` -------------------------------- ### Build Stand-alone Sendmail Binary Source: https://mailpit.axllent.org/docs/install/source Optionally build a stand-alone sendmail binary for Mailpit. This is useful if you are not symlinking or configuring your existing sendmail. Navigate to the sendmail directory first. ```bash cd sendmail go build -ldflags "-s -w" ``` -------------------------------- ### Mailpit sendmail command-line options Source: https://mailpit.axllent.org/docs/install/sendmail View all available command-line flags for Mailpit's `sendmail` implementation. Most flags are for compatibility and may be ignored. ```bash Usage: mailpit sendmail [flags] [recipients] < message Flags: -S string SMTP server address (default "localhost:1025") -f string Set the envelope sender address (default "user@host") -bs Handle SMTP commands on standard input -t Ignored -i Ignored -o Ignored -v Ignored ``` -------------------------------- ### Generate Self-Signed Certificate and Key Source: https://mailpit.axllent.org/docs/configuration/certificates Use this command to generate a self-signed TLS certificate and private key valid for 10 years. Ensure the Common Name matches your Mailpit hostname. ```bash openssl req -x509 -newkey rsa:4096 \ -nodes -keyout key.pem -out cert.pem \ -sha256 -days 3650 ``` -------------------------------- ### Readiness Check Source: https://mailpit.axllent.org/docs/integration/healthcheck The /readyz endpoint checks if Mailpit is ready to accept connections and process requests. A 200 OK response signifies that Mailpit is fully operational and ready. ```APIDOC ## GET /readyz ### Description Checks if the Mailpit service is ready to serve traffic. ### Method GET ### Endpoint /readyz ### Response #### Success Response (200) Returns a 200 OK status code if Mailpit is ready to accept requests. ``` -------------------------------- ### Accept Any Credentials for Send API Source: https://mailpit.axllent.org/docs/configuration/http For testing, configure the send API endpoint to accept any credentials or no credentials at all. This bypasses authentication for this endpoint only. ```bash mailpit --send-api-auth-accept-any ``` -------------------------------- ### Configure SMTP Relay via Environment Variables Source: https://mailpit.axllent.org/docs/configuration/smtp-relay Set the entire SMTP relay configuration using environment variables. MP_SMTP_RELAY_HOST is required; other variables are optional and have default values. ```bash MP_SMTP_RELAY_HOST= # required MP_SMTP_RELAY_PORT= # optional - default 25 MP_SMTP_RELAY_STARTTLS= # optional - connect using STARTTLS, default false MP_SMTP_RELAY_TLS= # optional - connect using TLS, default false MP_SMTP_RELAY_ALLOW_INSECURE= # optional - do not validate TLS certificate, default false MP_SMTP_RELAY_AUTH= # optional - default none MP_SMTP_RELAY_USERNAME= # required for plain, login and cram-md5 auth MP_SMTP_RELAY_PASSWORD= # required for plain & login auth MP_SMTP_RELAY_SECRET= # required for cram-md5 auth MP_SMTP_RELAY_RETURN_PATH= # optional - overrides Return-Path for all released emails MP_SMTP_RELAY_OVERRIDE_FROM= # optional - overrides the From email address MP_SMTP_RELAY_ALLOWED_RECIPIENTS="@example\.com$" # optional - regex to limit allowed relay addresses or domains via web UI & API MP_SMTP_RELAY_BLOCKED_RECIPIENTS="@example2\.com$" # optional - regex to prevent relaying to addresses or domains via web UI & API MP_SMTP_RELAY_PRESERVE_MESSAGE_IDS= # optional - preserve the original Message-IDs when relaying, default false MP_SMTP_RELAY_FWD_SMTP_ERRORS= # optional - whether to log smtp-errors or forward them to upstream-client ``` -------------------------------- ### Symlink Mailpit binary to sendmail Source: https://mailpit.axllent.org/docs/install/sendmail Create a symbolic link from the Mailpit binary to `sendmail` if Mailpit is on the same host and using the default port. ```bash ln -s /usr/local/bin/mailpit /usr/sbin/sendmail ``` -------------------------------- ### Allow insecure SMTP authentication for testing Source: https://mailpit.axllent.org/docs/configuration/smtp Enable SMTP authentication over plain text connections for testing purposes. Use with caution as passwords will not be encrypted. ```bash mailpit --smtp-auth-allow-insecure ``` -------------------------------- ### Send test email using telnet Source: https://mailpit.axllent.org/docs/install/testing Send an email directly to Mailpit using telnet by piping commands. ```bash { echo "EHLO localhost" echo "MAIL FROM: " echo "RCPT TO: " echo "DATA" echo "From: " echo "To: " echo "Subject: Your Subject" echo "" echo "Your message body" echo "." echo "QUIT" } | telnet localhost 1025 ``` -------------------------------- ### Go Linting Command Source: https://mailpit.axllent.org/docs/development/code-linting Use this command to check Go code for formatting issues and potential errors. It identifies unformatted files and shows differences. ```bash gofmt -s -l -d . ``` -------------------------------- ### Require SMTP clients to use STARTTLS Source: https://mailpit.axllent.org/docs/configuration/smtp Enforce STARTTLS for all SMTP connections. This ensures that clients must negotiate a TLS upgrade. ```bash mailpit --smtp-require-starttls ``` -------------------------------- ### Enable SMTP with SSL/TLS Source: https://mailpit.axllent.org/docs/configuration/smtp Configure Mailpit to use SSL/TLS for all SMTP communication. This requires clients to support full SSL/TLS. ```bash mailpit --smtp-tls-cert /path/to/cert.pem --smtp-tls-key /path/to/key.pem --smtp-require-tls ``` -------------------------------- ### Enable Chaos with Default Triggers Source: https://mailpit.axllent.org/docs/integration/chaos Use the `--enable-chaos` flag or `MP_ENABLE_CHAOS=true` environment variable to enable Chaos. This allows configuration via other methods but doesn't set any default failure probabilities. ```bash --enable-chaos ``` ```bash MP_ENABLE_CHAOS=true ``` -------------------------------- ### SMTP Forward Configuration (YAML) Source: https://mailpit.axllent.org/docs/configuration/smtp-forward Use this YAML structure to define SMTP forwarding settings in a configuration file. Specify recipient addresses, SMTP host and port, and security options like STARTTLS or TLS. Authentication methods and credentials are also configurable. ```yaml to: # required - comma-separated list of email addresses host: # required - SMTP host or IP to send via port: # optional - SMTP port, default 25 starttls: # optional - connect using STARTTLS, default false tls: # optional - connect using TLS, default false allow-insecure: # optional - do not validate TLS certificate, default false auth: # optional - default none username: # required for plain, login and cram-md5 auth password: # required for plain & login auth secret: # required for cram-md5 auth return-path: # optional - overrides Return-Path for all forwarded emails override-from: # optional - overrides the From email address forward-smtp-errors: # optional - whether to log smtp-errors or forward them to upstream-client ``` -------------------------------- ### SMTP Forward Configuration (Environment Variables) Source: https://mailpit.axllent.org/docs/configuration/smtp-forward Configure SMTP forwarding using environment variables for convenience. Essential variables include the recipient list and the SMTP host. Other settings like port, authentication, and TLS can also be specified. ```shell MP_SMTP_FORWARD_TO= # required - comma-separated list of email addresses top forward to MP_SMTP_FORWARD_HOST= # required - SMTP host or IP to send via MP_SMTP_FORWARD_PORT= # optional - default 25 MP_SMTP_FORWARD_STARTTLS= # optional - connect using STARTTLS, default false MP_SMTP_FORWARD_TLS= # optional - connect using TLS, default false MP_SMTP_FORWARD_ALLOW_INSECURE= # optional - do not validate TLS certificate, default false MP_SMTP_FORWARD_AUTH= # optional - default none MP_SMTP_FORWARD_USERNAME= # required for plain, login and cram-md5 auth MP_SMTP_FORWARD_PASSWORD= # required for plain & login auth MP_SMTP_FORWARD_SECRET= # required for cram-md5 auth MP_SMTP_FORWARD_RETURN_PATH= # optional - overrides Return-Path for all released emails MP_SMTP_FORWARD_OVERRIDE_FROM= # optional - overrides the From email address MP_SMTP_FORWARD_FWD_SMTP_ERRORS= # optional - whether to log smtp-errors or forward them to upstream-client ``` -------------------------------- ### Enable SpamAssassin with Postmark Service Flag Source: https://mailpit.axllent.org/docs/configuration/spamassassin Use this flag to enable integration with the Postmark service for spam analysis. No port is required when using Postmark. ```bash --enable-spamassassin postmark ``` -------------------------------- ### Set SMTP credentials via environment variable Source: https://mailpit.axllent.org/docs/configuration/smtp Provide SMTP authentication credentials as a space-separated list in the MP_SMTP_AUTH environment variable. This method is not available as a CLI flag for security reasons. ```bash export MP_SMTP_AUTH="user1:password1 user2:password" ``` -------------------------------- ### Ingest Messages from File or Folder Source: https://mailpit.axllent.org/docs/integration/importing Use this command to ingest messages from a file or folder. By default, messages are sent to localhost:1025. Specify a different SMTP address using `--smtp-addr`. ```bash mailpit ingest ``` ```bash mailpit ingest --smtp-addr ``` -------------------------------- ### Accept any username and password for SMTP authentication Source: https://mailpit.axllent.org/docs/configuration/smtp Configure Mailpit to accept any username and password, or none, for SMTP authentication. Useful for simplified testing scenarios. ```bash mailpit --smtp-auth-accept-any ``` -------------------------------- ### Generate Self-Signed Certificate with SAN Source: https://mailpit.axllent.org/docs/configuration/certificates This command generates a self-signed certificate including Subject Alternative Name (SAN), which is required by some SMTP clients. Replace `` with your Mailpit service hostname. ```bash openssl req -x509 -newkey rsa:4096 \ -nodes -keyout key.pem -out cert.pem \ -sha256 -days 3650 \ -addext "subjectAltName = DNS:localhost" ``` -------------------------------- ### Reread Supervisor Configuration Source: https://mailpit.axllent.org/docs/install/supervisor After creating or modifying the Mailpit service configuration file, tell Supervisor to reread its configuration files. ```bash supervisorctl reread ``` -------------------------------- ### Dump messages via network/API Source: https://mailpit.axllent.org/docs/usage/import-export Export all messages from a running Mailpit instance over HTTP. Supply the HTTP host and port using the --http flag. Include the --webroot if configured. Basic authentication can be included in the URL. ```bash mailpit dump --http http://localhost:8025 ``` ```bash mailpit dump --http http://user:password@localhost:8025 ``` -------------------------------- ### SMTP Relay Configuration File Source: https://mailpit.axllent.org/docs/configuration/smtp-relay Define SMTP relay settings in a YAML configuration file. Specify the host, port, TLS/STARTTLS options, authentication method, and credentials. Optional fields include return-path, override-from, and recipient filtering. ```yaml host: # required - SMTP host or IP to send via port: # optional - SMTP port, default 25 starttls: # optional - connect using STARTTLS, default false tls: # optional - connect using TLS, default false allow-insecure: # optional - do not validate TLS certificate, default false auth: # optional - default none username: # required for plain, login and cram-md5 auth password: # required for plain & login auth secret: # required for cram-md5 auth return-path: # optional - overrides Return-Path for all released emails override-from: # optional - overrides the From email address allowed-recipients: '@example\.com$' # optional - limit allowed relay addresses or domains blocked-recipients: '@example2\.com$' # optional - prevent relating to addresses or domains preserve-message-ids: # optional - preserve the original Message-IDs when relaying, default false forward-smtp-errors: # optional - whether to log smtp-errors or forward them to upstream-client ``` -------------------------------- ### Use Mailpit sendmail in php.ini Source: https://mailpit.axllent.org/docs/install/sendmail Configure `php.ini` to use the `mailpit sendmail` command for email delivery. Ensure the path to the Mailpit binary is correct. ```ini sendmail_path = /usr/local/bin/mailpit sendmail ``` -------------------------------- ### Proxy Mailpit via Caddy (Root Path) Source: https://mailpit.axllent.org/docs/configuration/proxy Configure Caddy to proxy requests to Mailpit at the root path. The 'Host' header is forwarded using 'header_up'. ```caddy localhost:80 { reverse_proxy 172.17.0.1:8025 { header_up Host {host} } } ``` -------------------------------- ### Update Supervisor Services Source: https://mailpit.axllent.org/docs/install/supervisor Apply the reread configuration by updating the Supervisor services to include the new Mailpit service. ```bash supervisorctl update ``` -------------------------------- ### Check Mailpit Service Status Source: https://mailpit.axllent.org/docs/install/supervisor Verify that the Mailpit service is running correctly using the Supervisor control utility. ```bash supervisorctl status ``` -------------------------------- ### Configure Dedicated Send API Authentication Source: https://mailpit.axllent.org/docs/configuration/http Set up separate authentication for the send API endpoint using a password file. This ensures only specific credentials can be used for sending messages. ```bash mailpit --send-api-auth-file /path/to/send-api-password-file ```