Skip to content

Configuration

Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means we highly recommend scanning the services documentation to get a good handle on how the magicks work.

Also note that options, in addition to the build steps and overrides that are available to every service, are shown below:

yaml
services:
  mailpit:
    type: mailpit:1.25
    mailFrom:
      - appserver
    maxMessages: 500
    port: 1025

Configuration Options

mailFrom

The mailFrom config key lets you specify which services should be configured to send mail through Mailpit. While this configuration is optional, it enables automatic setup of mail sending capabilities in the specified services.

When services are listed under mailFrom, Lando will:

  1. Install the mailpit binary as a sendmail replacement at /helpers/mailpit
  2. Configure environment variables (MAIL_HOST and MAIL_PORT) for SMTP access
  3. For PHP services, configure php.ini to use the Mailpit sendmail binary, enabling PHP's built-in mail() function to automatically route through Mailpit

If you have an appserver service in your application, it will be automatically added to mailFrom by default. You can discover available services by running lando info.

Example configuration with explicit mail service setup:

yaml
services:
  mailpit:
    type: mailpit:1.25
    mailFrom:
      - phpapp
  phpapp:
    type: php

maxMessages

The maximum number of messages to store before truncating. Must be at least 1.

yaml
services:
  mailpit:
    type: mailpit:1.25
    maxMessages: 1000  # Store up to 1000 messages

port

The SMTP port to use for sending mail to Mailpit. Must be between 1 and 65535.

yaml
services:
  mailpit:
    type: mailpit:1.25
    port: 2525  # Use custom SMTP port

Port Forwarding

portforward

This option is inherited from the lando base service. It allows external access to the service by mapping a port on your host's localhost. For more details, refer to the Lando documentation on external access.

yaml
services:
  mailpit:
    type: mailpit:1.25
    portforward: true