Skip to content

AS213941 · Peering-20% on all VPS with code NVH20 · Delivered in 60 seconds

Linux VPSFrom 2,49 €/monthWindows VPSFrom 3,49 €/monthFiveM serverFrom 0,99 €/monthMinecraft serverFrom 1,99 €/month
VPS & Cloud

Ranges

Linux NVMe VPSRoot access, Debian, Ubuntu, Alma…Windows RDP VPSRemote desktop, licence includedDedicated serversIntel Xeon Gold, exclusive resourcesPterodactyl VPSGame panel preinstalled

Network and hosting

Anti-DDoSWeb hostingColocationIP transitVPN

Professionals

Reseller VPSReseller programme
Solutions

Bots and automation

AI agents VPSA server for your coding assistants and autonomous agentsTelegram bot VPSPython or Node.js, always reachableDiscord bot VPSMusic, moderation, tickets: no downtimen8n VPSWorkflows with no execution limitVPN VPSAn encrypted tunnel exiting in FranceWeb scraping VPSScheduled data collection, dedicated IP

Trading

Forex VPSYour robots manage positions overnightMetaTrader 4 VPSSeveral MT4 terminals on one machineMetaTrader 5 VPSForex, indices and stocks in MT5NinjaTrader VPSFutures and NinjaScript strategiesTrading bot VPSOpen-source crypto bots, protected API keys

Windows desktop

Windows 10 VPSFor software that requires Windows 10Windows 11 VPSA modern Windows desktop, reachable anywhereSEO VPSLarge-site crawls without tying up your PCStreaming VPSAn OBS studio streaming from the data centreWordPress VPSFast websites on NVMe disks
Marketplace

Intelligence artificielle

Claude CodeL'agent de code d'Anthropic, dans votre terminalCodex CLIL'agent de code d'OpenAI en ligne de commandeOllamaDes modèles de langage locaux, sans API externeOpen WebUIUne interface de discussion pour vos modèles Ollama

Automatisation

n8nVos automatisations, sans limite d'exécutions

Déploiement et conteneurs

DockerLe moteur de conteneurs et Docker ComposeCoolifyDéployez vos applications depuis Git, sur votre serveurPortainerGérez vos conteneurs Docker depuis le navigateur

Supervision

Uptime KumaSurveillez vos sites et serveurs, alertes comprises

Network and security

WireGuardVotre propre VPN chiffré, rapide et moderneVaultwardenUn gestionnaire de mots de passe auto-hébergé

Sites et cloud

NextcloudVotre cloud de fichiers, agenda et contactsWordPressLe CMS le plus utilisé, sur une pile Nginx rapide

Jeux

PterodactylLe panel pour héberger vos serveurs de jeux
Gaming

Game servers

FiveM servertxAdmin, ESX, QBCoreMinecraft serverJava, Bedrock, modpacksRust serverOxide, Carbon, wipesNova-Life serverNova-Life: Amboise RP

Protection and tools

FiveM Anti-DDoSFree tools
Resources

Learn

DocumentationBlog

Assistance

ContactSLA commitment
View plans Client area Peering · AS213941

Email

Configuring Postfix to send email from your VPS

By the NVHCloud team · 2026-09-18 · 4 min read

A server often needs to send email: monitoring alerts, Logwatch reports, a website's password resets, application notifications. This guide configures send-only Postfix, the simplest and most reliable configuration for these uses.

1. What do you need?

  • Sending notifications from the server: that is what this guide covers.
  • Sending from a website (WordPress, shop): the simplest option is often to configure the site to use an SMTP provider directly, through a plugin. Postfix remains useful if several applications need to send.
  • Hosting complete mailboxes, with receiving and webmail: a much heavier project, which requires IP reputation, monitoring and maintenance. For most projects, hosted email or the mail included with Plesk web hosting is more sensible.

2. Why go through an SMTP relay

In theory a server can send email directly to the destination servers. In practice, it is the best way to end up in spam: large providers such as Gmail or Outlook distrust server IP addresses with no sending history, and many hosts filter outbound port 25 to fight spam.

The solution is to relay: Postfix hands messages to a specialised SMTP provider (Brevo, Mailjet, Amazon SES, Postmark, or your domain's mail service), which takes care of deliverability. Sending goes through port 587, authenticated and encrypted.

3. Install Postfix

apt update && apt install -y postfix libsasl2-modules mailutils

When asked for the configuration type, choose Satellite system. As the mail name, enter the server's full name, for example web01.yourdomain.com, and as the relay your provider's SMTP address in square brackets, for example [smtp.provider.com]:587. The brackets tell Postfix to use the name as is, without looking for an MX record.

4. Configure the relay

Add these lines to /etc/postfix/main.cf, or check they are there:

relayhost = [smtp.provider.com]:587
inet_interfaces = loopback-only
mydestination =
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
  • inet_interfaces = loopback-only: Postfix only accepts messages from the server itself. It cannot be used as a relay by strangers, and no port needs opening in the firewall.
  • Empty mydestination: the server does not consider itself the destination for any domain, so everything is relayed.
  • smtp_tls_security_level = encrypt: the connection to the relay is always encrypted; credentials never travel in clear text.

5. SMTP credentials

Create /etc/postfix/sasl_passwd with the username and password provided by your relay:

[smtp.provider.com]:587 username:password
chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
systemctl restart postfix

The postmap command creates the version Postfix actually reads. Run it again after every change to the file.

6. The sender address

By default, messages are sent from [email protected]. Most relays refuse a sender that does not belong to a domain verified with them. Rewrite the sender address to an address on your domain:

echo '/.+/ [email protected]' > /etc/postfix/sender_canonical
echo 'sender_canonical_maps = regexp:/etc/postfix/sender_canonical' >> /etc/postfix/main.cf
systemctl reload postfix

For these messages not to land in spam, the domain must be authenticated: see configuring SPF, DKIM and DMARC.

7. Test

echo "Test from $(hostname)" | mail -s "Postfix test" [email protected]
journalctl -u 'postfix*' -n 20 --no-pager

In the log, look for status=sent: the relay accepted the message. If you receive it, check it is not in the spam folder. To receive messages addressed to root, such as cron's, add the line root: [email protected] to /etc/aliases, then run newaliases.

8. Troubleshoot

In the logLikely cause
SASL authentication failedWrong username or password, or postmap forgotten after a change.
Connection timed outOutbound port 587 is blocked or the relay address is wrong.
Sender address rejectedThe sender address does not belong to a domain verified with the relay.
no mechanism availableThe libsasl2-modules package is not installed.

The queue of pending messages is shown with mailq, and postqueue -f forces a new delivery attempt.

Frequently asked questions

Why do emails sent from my VPS land in spam?

Because a new server's IP address has no sending reputation and the domain is often not authenticated. Go through a specialised SMTP relay and publish your domain's SPF, DKIM and DMARC records: that is what decides deliverability.

Do I need to open port 25 in the firewall?

No, not for sending. Inbound port 25 is only used to receive mail. With the configuration in this guide, Postfix only listens on the local address and sends to the relay over port 587.

Can I use my Gmail account as a relay?

It is possible with an app password, but Gmail limits the number of daily sends and rewrites the sender. That is acceptable for a few personal alerts, not for a website's or an application's email.

Can Postfix host my mailboxes?

Postfix is one building block of a complete mail server, which also needs Dovecot, an anti-spam filter, webmail and constant reputation monitoring. For a few mailboxes, a hosted solution costs less time and offers better deliverability.

Linux NVMe VPS

Root access, Intel Xeon Gold and NVMe, delivered in 60 seconds. From 2,49 €/month.