Skip to main content

[How-To] Configure BookStack to Use SMTP Email

Configure BookStack to use SMTP for email

​Learn how to configure BookStack wiki to use SMTP for email sending.

Prerequisites:

  • Login into the BookStack service over SSH.
  • Have your SMTP credentials ready.

Step 1: Open the BookStack .env file

Open the BookStack .env file using the following command.

nano /var/www/bookstack/.env

Step 2: Find the default email settings

The email settings start at the 'MAIL_DRIVER' line.

BookStack default email settings

Step 3: Update the email settings

Update the email settings to reflect your SMTP service. Here are the default settings.

# Mail system to use
# Can be 'smtp' or 'sendmail'
MAIL_DRIVER=smtp

# Mail sender details
MAIL_FROM_NAME="BookStack"
MAIL_FROM=bookstack@example.com

# SMTP mail options
# These settings can be checked using the "Send a Test Email"
# feature found in the "Settings > Maintenance" area of the system.
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Here is an example using the K&T SMTP service.

# Mail system to use
# Can be 'smtp' or 'sendmail'
MAIL_DRIVER=smtp

# Mail sender details
MAIL_FROM_NAME="MY Wiki"
MAIL_FROM=bookstack@mydomain.com

# SMTP mail options
# These settings can be checked using the "Send a Test Email"
# feature found in the "Settings > Maintenance" area of the system.
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=bookstack@mydomain.com
MAIL_PASSWORD=mysupersecurepassword
MAIL_ENCRYPTION=tls

When finished, restart the apache2 service:

systemctl restart apache2

Step 4: Test email sending

BookStack has a email test function under the maintenance area. Login as an administrative user, and navigate to Settings > Maintenance.

BookStack send email test

Click the SEND TEST EMAIL link and watch for the success or error message. The message will show up on the top corner of the browser. It should be green and confirm email sending. If not, review the error message and adjust settings for your SMTP service.​

This article applies to BookStack version 24+