SMTP? Postfix + Dovecot, "Relay Access.." SOLVED

I've followed the postfix guide (~~[" target="_blank">]( … 0.04-lucid">]() to the letter (I think) and installed postfix, dovecot and saslauthd. I've setup my domains and users and I can receive emails perfectly fine, but I can't send them. I think there's problems trying to connect to the SMTP server or something?

In Roundcube I get this error message:

SMTP Error (554): Failed to add recipient "" (5.7.1 : Relay access denied)

I've also tried using two other (windows) email clients which can both receive emails fine but can't connect to the SMTP server.

Here's the results of a telnet:

telnet localhost 25
ehlo localhost
250-SIZE 30720000
250 DSN

Here's my postfix file:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no

smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =, localhost, localhost.localdomain
relayhost = 
mynetworks =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
message_size_limit = 30720000
virtual_alias_domains = 
virtual_alias_maps = proxy:mysql:/etc/postfix/, mysql:/etc/postfix/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/
virtual_mailbox_maps = proxy:mysql:/etc/postfix/
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Am I doing something wrong here? Or perhaps I'm using wrong settings in my mail client?

I've trying something like this:

SMTP server:

SMTP Port: 25

SMTP Auth: Yes

Authentication: PLAIN

It doesn't even seem to connect to the smtp server…

Any help would be greatly appreciated. Thanks!

9 Replies

I've now managed to connect to the smtp server from my desktop mail client, but I get the same message as I got from roundcube "Relay Access Denied" when it tries to send an email

It looks like your sasl isn't working - what do your logs say when you try to send an email?

Here's a something from /var/log/mail.log

Feb  6 19:29:19 li244-40 postfix/smtpd[10658]: warning: hostname verification failed: Name or service not known
Feb  6 19:29:19 li244-40 postfix/smtpd[10658]: connect from unknown[]
Feb  6 19:29:19 li244-40 postfix/smtpd[10658]: warning: non-SMTP command from unknown[]: GET / HTTP/1.1
Feb  6 19:29:19 li244-40 postfix/smtpd[10658]: disconnect from unknown[]

Otherwise there's lots of entries like this

Feb  6 19:14:06 li244-40 dovecot: imap-login: Login: user=<>, method=PLAIN, rip=, lip=, secured
Feb  6 19:14:06 li244-40 dovecot: IMAP( Disconnected: Logged out bytes=63/492</>

Ah!, this bit could be what we're looking for:

Feb  6 19:07:14 li244-40 postfix/smtpd[10266]: connect from[]
Feb  6 19:07:16 li244-40 postfix/smtpd[10266]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
Feb  6 19:07:16 li244-40 postfix/smtpd[10266]: warning:[]: SASL LOGIN authentication failed: gener$
Feb  6 19:07:17 li244-40 postfix/smtpd[10266]: NOQUEUE: reject: RCPT from[]: 554 5.7.1 <emmanuelhi$ 6="" 554="" feb="" 19:07:19="" li244-40="" postfix="" smtpd[10266]:="" disconnect="" from=""[]="" 19:09:21="" dovecot:="" sighup="" received="" -="" reloading="" configuration="" 19:09:22="" auth-worker(default):="" mysql:="" connected="" to="""" (mail)="" 19:09:31="" smtpd[10319]:="" connect="" 19:09:33="" warning:="" sasl="" authentication="" failure:="" cannot="" saslauthd="" server:="" no="" such="" file="" or="" directory=""[]:="" login="" failed:="" gener$="" noqueue:="" reject:="" rcpt="" 5.7.1="" <emmanuelhi$="" 19:09:35="" 19:09:53="" (mail)<e=""></emmanuelhi$>

This bit > Feb 6 19:07:16 li244-40 postfix/smtpd[10266]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory looks like the problem.

So there must be something wrong with the saslauthd server?

Looks like it, first try

service saslauthd restart

if that doesn't work try running through … _use_mysql"> again

Okay, Tried "service saslauthd restart", which did this:

 * Stopping SASL Authentication Daemon saslauthd                    [ OK ]
 * Starting SASL Authentication Daemon saslauthd                    [ OK ]

Yes, and then I carefully went through that section of the tutorial, but nothing has changed :(

Well that about covers the extent of my mail server knowledge (don't run one, never have), so I'll have to defer to someone who does.

Okay, well thanks for trying.

I still haven't figured it out. :(

Okay, now I'm getting another slightly different error message. Probably related to the same problem though:

Feb  7 06:53:11 li244-40 postfix/smtpd[16108]: warning:[]: SASL LOGIN authentication failed: authentication failure

Problem Solved!

Ended up uncommenting the following lines from the /etc/postfix/ file

  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

As well as adding this new line

submission inet n - n - - smtpd

Now it works like a charm, the host rejected error was just because I had the wrong password.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct