Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Fayçal Borsali's avatar

Setting up vps for sending emails

I have deployed a Laravel app to a VPS, I can manage the DNS of the domain name pointing to it.

My app needs to send some emails (upon signup for example) so I need to configure a mail host.

However I did not quite understand what I need to install ! I've been reading articles for days, I just don't get it. Do I need postfix ? exim ? dovecot ? all of them ? none of them ? I just want to configure my server to be able to get the necessary details to put in my .env

MAIL_MAILER=smtp
MAIL_HOST=mail.my-beatiful-domain-name.tld
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=

I am using A2hosting and have the webuzo panel installed but I didn't find any tool that allows me to configure my mail server.

0 likes
4 replies
CorvS's avatar

What OS is your server running? Have you considered using a mail service provider like Mailgun or Amazon SES? Mailgun for example allows you to send 1000 emails for free each months and can be setup and integrated in no time. You have to consider that it's not done with just setting up a SMTP server, there has to be done much more in order to reliably send emails. Especially if we are talking about bulk sending (e.g. newsletters).

Fayçal Borsali's avatar

Thank you for your answer.

My server is running on Ubuntu 20.04

You are pointing at exactly what I need. I don't know everything that needs to be set up. If only I could find a list of things that need to be done (an SMTP server and what ?) that way I could decide if it's worth the learning curve or I should go with a mail service provider (thanks for mentioning these two)

DeteCT0R's avatar

You are already has VPS. What you need is a mail server ex: modoboa its a free open source mail server. (Its has all the feature what u need and its install with all stuff what u need. (Postfix Dovecot etc..)

https://www.linuxbabe.com/mail-server/modoboa-email-server-ubuntu-20-04

What i recommend is to setup first the mail server with an empty VPS. The mail server comes with all the stuff what need to run. (Mysql / Nginx etc) so its does gonna fail with the install. After that you can deploy laravel and install the other stuffs what u need.

Please or to participate in this conversation.