I have postfix and dovecot setup to deal with mail for my domain. imap appears to work ok when reading local mail but when i try to send an email using telnet with localhost and the smtp port it gives me the relay access denied error.

    [root@vps69576 ~]# telnet localhost smtp
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    220 mail.domain.net ESMTP Postfix
    ehlo domain.net
    250-SIZE 10240000
    250 DSN
    mail to:
    501 5.5.4 Syntax: MAIL FROM:<address>
    mail from:dan@domain.net
    250 2.1.0 Ok
    rcpt user@gmail.com
    554 5.7.1 <user@gmail.com>: Relay access denied

The contents of the main.cf file are

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/libexec/postfix

data_directory = /var/lib/postfix
mail_owner = postfix

myhostname = mail.domain.net

mydomain = domain.net

myorigin = $mydomain

inet_interfaces = all

inet_protocols = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

unknown_local_recipient_reject_code = 550

mynetworks =, <site IP>

relay_domains = 

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

home_mailbox = Maildir/

sendmail_path = /usr/sbin/sendmail.postfix

newaliases_path = /usr/bin/newaliases.postfix

mailq_path = /usr/bin/mailq.postfix

setgid_group = postdrop

html_directory = no

manpage_directory = /usr/share/man

sample_directory = /usr/share/doc/postfix-2.6.6/samples

readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

You are connecting to localhost via IPv6 (::1), but that address is not part of the "mynetworks" list. Change it to

mynetworks =, <site IP>, [::1]/128

and it should work.

  • This partially worked. "telnet localhost smtp" executes fine and the mail was delivered. when i use telnet smtp.domain.com 25 it gives me another relay error. It is using the ipv6 of my domain which ends with ::3e0. im assuming its because the /128 doesnt cover the range from this hex number. I tried pasting the ipv6 ip into mynetworks and it causes an error when i run telnet – Dan Hastings Jul 18 '14 at 15:29
  • 1
    i got around this by copying the ipv6 address with square brackets around it so [xxxx:xxxx:xxx::xxx] – Dan Hastings Jul 18 '14 at 16:09
  • 1
    Right – it depends what IP address you are connecting from. To be sure, you can put all local IP addresses into mynetworks, like this: mynetworks = [::ffff:]/104 [::1]/128 [2001:db8:1407:c3a0::]/60 – JyrgenN Jul 19 '14 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.