How to use local SMTP sever and Nextcloud?

HI,
i have a classic debian LAMP installation with Postfix as SMTP server.
i am running for me and friends an nextcloud installation.

the question is:

how to use mail accounts with SMTP sever loccalhost ? Why do i have to place a domain in the smtp field of every mail account ?

If i put all information in, i can’t send mail to any external email domain, only to my domain. i don’t get any errors.
I just dont get it right now i guess. bit confused, i am missing my bash here.

so what do i miss here ?

Thank you!

Debian is : bullseye
Nextcloud is: 25.0.3

There is a lot more to a working mail setup than that. You’ll need a domain and proper mail DNS records at the very least, if you want to send and/or receive from other systems.

This is probably isn’t the best place for postfix-specific questions, but maybe we can answer some.

3 Likes

That’s just how email addresses work. A domain is required.

The error would be in the syslog from postfix.

1 Like

OK,
i have a domain with proper MX record.
As i said i have a LAMP Server > Linux Apache Mysql Php

Everything is on this sever. So Postifix is also on this server.
so why should i use my.maildomain.com instead of localhost ?
makes no sense for me, because nextcloud is running on the same server and could contact the mailsever via localhost.

Don’t forget SPF. Very important if it will communicate with other email systems. Some won’t talk to you without a PTR too.

As far as the domain part, you’ll have to explain in some detail or maybe show configs because I can’t tell what you’re getting at, i.e. are you trying to email user@localhost? Where are you entering localhost?

next.imap

instead putting a imap host like my.maildomain.com in here i like to put localhost in.

Yes that won’t work, because Postfix is no IMAP server. For that you would need something like Dovecot.

And no offense, but all this doesn’t sound like you’ve really looked into how email servers work and what the requirements are to run one. It is possible to run a fully fledeged mail server on the same server as Nextcloud is running, but there’s a lot more to it, than just installing Postfix and connecting Nextcloud Mail to localhost.

Also this doesn’t really have anything to do with Nextcloud. Nextcloud Mail, is just a regular email client that can connect to existing mail accounts om existing mail servers via SMTP and IMAP. Just like Thunderbird or any other desktop email client…