Email setup on Ubuntu 20.04- Over my head! #1960

Closed
opened 2026-02-05 02:19:59 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @mtnyaeger on GitHub (Dec 9, 2020).

I am currently trying out bookstack on a droplet with Ubuntu 20.04 install. This was a blank state before I ran the script to install Bookstack from Github. Install went fine and the product works except for email. When I test email I receive the following error.
"Error thrown when sending a test email: Connection could not be established with host localhost :stream_socket_client(): unable to connect to localhost:1025 (Connection refused)"
I realized that I had provided no setup[ for a smtp server. Now I am lost everything seems to be for a different platform. I finally worked out how to edit the .env file through FTP on the root level. it was blank so I added
MAIL_DRIVER=smtp

Host, Port & Encryption mechanism to use (has a pound sign before it)
MAIL_HOST=smtp.office365.com
MAIL_PORT=465
MAIL_ENCRYPTION=tls

Authentication details for your SMTP service (has a pound sign before it)
MAIL_USERNAME=Joe@smurfs.com
MAIL_PASSWORD=1234

MAIL_DRIVER=sendmail

The "from" email address for outgoing email (has a pound sign before it)
MAIL_FROM=Joe@smurfs.com

The "from" name used for outgoing email (has a pound sign before it)
MAIL_FROM_NAME=BookStack

Code to it and overwrote the file that existed. Rebooted the droplet and nothing changed. What do I not know? Do I need to install a mail service of some type or am I editing the wrong file? I am okay at programming but am not trained and this is the first droplet Linux server I have ever dealt with. Thanks

Originally created by @mtnyaeger on GitHub (Dec 9, 2020). I am currently trying out bookstack on a droplet with Ubuntu 20.04 install. This was a blank state before I ran the script to install Bookstack from Github. Install went fine and the product works except for email. When I test email I receive the following error. "Error thrown when sending a test email: Connection could not be established with host localhost :stream_socket_client(): unable to connect to localhost:1025 (Connection refused)" I realized that I had provided no setup[ for a smtp server. Now I am lost everything seems to be for a different platform. I finally worked out how to edit the .env file through FTP on the root level. it was blank so I added MAIL_DRIVER=smtp Host, Port & Encryption mechanism to use (has a pound sign before it) MAIL_HOST=smtp.office365.com MAIL_PORT=465 MAIL_ENCRYPTION=tls Authentication details for your SMTP service (has a pound sign before it) MAIL_USERNAME=Joe@smurfs.com MAIL_PASSWORD=1234 MAIL_DRIVER=sendmail The "from" email address for outgoing email (has a pound sign before it) MAIL_FROM=Joe@smurfs.com The "from" name used for outgoing email (has a pound sign before it) MAIL_FROM_NAME=BookStack Code to it and overwrote the file that existed. Rebooted the droplet and nothing changed. What do I not know? Do I need to install a mail service of some type or am I editing the wrong file? I am okay at programming but am not trained and this is the first droplet Linux server I have ever dealt with. Thanks
OVERLORD added the 🐕 Support label 2026-02-05 02:19:59 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 10, 2020):

Hi @mtnyaeger,

I finally worked out how to edit the .env file through FTP on the root level. it was blank so...

If that file was blank or missing then you're likely not editing the correct file in the right place. After an install using the Ubuntu 20.04 install script you'll find the .env file at the location /var/www/bookstack/. You should see lots of other files and folders there also. If you cannot see a .env file there please check your FTP software for an option to view hidden files. Files starting with a dot are often hidden in the world of linux.

When you edit that file you should not need to reboot the server, Should be able to just change the mail settings then re-click the "Send Test Email" button in BookStack.

Make sure you only set one MAIL_DRIVER option when editing that file. Using smtp will then use the details of the MAIL_HOST, MAIL_PORT and MAIL_ENCRYPTION.

I am okay at programming but am not trained and this is the first droplet Linux server I have ever dealt with.

That's okay, We've all been there. Entering the world of linux, and the weeds of web hosting setups, can be a steep hill to climb but will be very handy for future endeavours, especially if handy with programming.

@ssddanbrown commented on GitHub (Dec 10, 2020): Hi @mtnyaeger, > I finally worked out how to edit the .env file through FTP on the root level. it was blank so... If that file was blank or missing then you're likely not editing the correct file in the right place. After an install using the Ubuntu 20.04 install script you'll find the `.env` file at the location `/var/www/bookstack/`. You should see lots of other files and folders there also. If you cannot see a `.env` file there please check your FTP software for an option to view hidden files. Files starting with a dot are often hidden in the world of linux. When you edit that file you should not need to reboot the server, Should be able to just change the mail settings then re-click the "Send Test Email" button in BookStack. Make sure you only set one `MAIL_DRIVER` option when editing that file. Using `smtp` will then use the details of the `MAIL_HOST`, `MAIL_PORT` and `MAIL_ENCRYPTION`. > I am okay at programming but am not trained and this is the first droplet Linux server I have ever dealt with. That's okay, We've all been there. Entering the world of linux, and the weeds of web hosting setups, can be a steep hill to climb but will be very handy for future endeavours, especially if handy with programming.
Author
Owner

@KieranFJ commented on GitHub (Dec 10, 2020):

The MAIL_PORT= i believe should also be 587 as i recently set up our installation with a office365 mail account. Works a treat.

@KieranFJ commented on GitHub (Dec 10, 2020): The MAIL_PORT= i believe should also be 587 as i recently set up our installation with a office365 mail account. Works a treat.
Author
Owner

@mtnyaeger commented on GitHub (Dec 10, 2020):

@ssddanbrown Thank you this was a huge help.
I had FTP connected to root thinking I was at the top of the hierarchy. However, since you listed the path I needed tried going up a level and found what I needed. I correct the proper .env file and changed the port to 587 which I had tried originally but could not get to work.
@KieranFJ Thank you as well

@mtnyaeger commented on GitHub (Dec 10, 2020): @ssddanbrown Thank you this was a huge help. I had FTP connected to root thinking I was at the top of the hierarchy. However, since you listed the path I needed tried going up a level and found what I needed. I correct the proper .env file and changed the port to 587 which I had tried originally but could not get to work. @KieranFJ Thank you as well
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1960