Problems with SMTP Postfix

I have a fresh installation of Virtualmin on my Ubuntu 18.04 VPS (freshly installed OS too) and I installed Virtualmin by using the install script.
Everything is working properly. I also installed Roundcube.
When testing the email sending feature from Webmin, the email successfully arrived to my gmail.
But when I tried sending an email by SMTP from a external client (C# program), it gives the following error: Transaction failed. The server response was: 5.7.1 <>: Relay access denied
When trying to send an email from Roundcube, I get the following error: SMTP error (454): Authentication Failed
I tested Dovecot by sending an email from to and it works fine, I get the email pretty quickly and I can see it in Roundcube.

I have tried many things and nothing helped, so any help will be appreciated.

Welcome to the community, Yash.

It appears that your email client is not authenticating itself for the domain / email address that it is attempting to send from on your Virtualmin box and so the email which it attempts to send out is being rejected.


You are almost there, keep at it. It seems to be a simple authentication issue.

After having sent a test email from within Webmin, try an external email program - Outlook, Thunderbird, etc. and if that works - Virtualmin\Postfix is behaving fine and you have an issue with your C# script.

My suspicion is that your C# script isn’t authenticating and the server sees it as an attempt to relay and denies it. In most email programs (Outlook, Thunderbird) when you set up an email account - in the settings you enter email server name/IP, username, password - there is usually a field that is labelled something like “My Outgoing Email Server requires Authentication” - if you don’t tick\select that, you’ll get the error message about Relay Access Denied.



Installed Thunderbird and tried what you said, it just can’t connect to SMTP.
The C# program works fine because I tested it with gmail and other SMTPs, and Roundcube doesn’t work either anyway and it’s on localhost on the VPS.

Couldn’t find a fix in there either

Can you post up your Postfix configuration?

You gotta post relevant log entries from the server maillog or mail.log. Trying to debug it from the client side is reading tea leaves.

Gotta be one of the best posts I’ve seen in a long time. ROFL.

ha ha, that’s true…

When I originally read your post - I thought you must have missed something.

Guess what - I just built a VPS with Ubuntu 18.04 and Roundcube doesn’t work - just get a 500 Internal Server Error when I try and log in. Emails will go in & out via Webmin\Virtualmin.

I just tried to connect an email client to the VPS - Thunderbird & guess what: it can’t connect as well. I’d be happy if it could just connect to port 110 and pull the 4 test emails that are sat there.

At least then I’d be halfway and could look into why Thrunderbird won’t connect to port 25.

I’ve looked thru more logs than I care to remember - had the firewall up & down like a yoyo and still no joy.

I’ve been at it way too many hours - going to get some sleep.

But I’ll be back & will get to the bottom of it.


I’ve made some progress:

  1. I removed all the entries in iptables (having a copy saved 1st) - iptables -F
  2. Check using iptables -L -nv that only the 3 default accept entries existed.
  3. I used to check connectivity to Dovecot and the webpage listed the handful of emails that were\are in the mailbox for the test user.
  4. I removed all the Restrictions in Postfix that related to Sender, HELO, Client & Recipient. (recorded what they were 1st) and restarted Postfix.
  5. I used to test sending emails to another account on another mailserver.
  6. Test email arrived.
  7. enabled the Postfix restrictions 1 at a time - Helo, Sender, Client & Recipient, each time sending a test email via and they all arrived.
  8. enabled the iptables rules and check they were in place.
  9. Tested SMPT and POP3\IMAP again and no issues.

Thunderbird still wouldn’t connect or validate the email account.

So I decided to check my IP (the home broadband one) using

fail2ban-client status | grep "Jail list:" | sed "s/ //g" | awk '{split($2,a,",");for(i in a) system("fail2ban-client status " a[i])}' | grep "Status\|IP list"

and guess what it was listed under Postfix.

A quick

fail2ban-client set postfix-mail unbanip 111.222.333.444

got that unbanned. Tried testing Thunderbird again - still no look. So tried Outlook instead - this successfully connected, pulled down the emails in the mailbox.

Sent an email from Outlook (from the test email account on the new host) to an external email account and it arrived successful.

The above shows me that the basics on the server are working fine.

Still got issues with not being able to log in via RoundCube - still working on that. And why Thunderbird won’t connect.



Figured out the issue with Thunderbird.

When you 1st install in and run it - cancel on setting up an account. Enable offline mode - bottom left hand corner of screen, the 2 computer screens logos.

Then set up your account - using the same details as you tried before. The outgoing server

Port - it selected 587 (i left it at that).

Connection Security - STARTTTLS
Authentication method - Normal password
Username - enter your email address

Then set it to online and it connected pulling down emails from the test account.

On trying to send\reply to external account - it complained about the servers cert and asked me to check\download it. After that Thunderbird behaved itself.

I think the cert issue is unavoidable - Postfix uses a single SSL cert, which in my case is for the master hosting domain, not the hosted domains.

I haven’t looked into the specifics of SNI in Postfix yet.

HIH someone.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.