# Relay access denied on postfix

## eje211

Hello, all!

I've just spend about 20 hours on this. No matter what I do, I get a

Relay access denied. This server is the final destination of the

email. There are no blocks or restrictions that I know of. So why is

this happening?

postconf -n :

```

alias_maps = hash:/etc/aliases

command_directory = /usr/sbin

[quote]config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

debug_peer_level = 5

home_mailbox = Maildir/

html_directory = no

inet_interfaces = all

mail_owner = postfix

mail_spool_directory = /var/mail

mailbox_command = /usr/bin/procmail -a "$EXTENSION"

mailq_path = /usr/bin/mailq.postfix

manpage_directory = /usr/share/man

mydestination = $myhostname, localhost.$mydomain, localhost

mydomain = mydomain.co.uk

myhostname = mail.mydomain.co.uk

mynetworks_style = host

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases.postfix

queue_directory = /var/spool/postfix

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

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

sendmail_path = /usr/sbin/sendmail.postfix

setgid_group = postdrop

unknown_local_recipient_reject_code = 550
```

This causes:

 *Quote:*   

> This is an automatically generated Delivery Status Notification
> 
> Delivery to the following recipient failed permanently:
> 
>    eje211@mydomain.co.uk
> ...

 

From /var/log/mail/maillog:

```
--snip--

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: >>> START Recipient address RESTRICTIONS <<<

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: generic_checks: name=permit_mynetworks

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: permit_mynetworks: wx-out-0506.google.com 11.249.81.229

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: match_hostname: wx-out-0506.google.com ~? 127.0.0.1/32

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: match_hostaddr: 11.249.81.229 ~? 127.0.0.1/32

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: match_hostname: wx-out-0506.google.com ~? 192.168.20.10/32

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: match_hostaddr:11.249.81.229 ~? 192.168.20.10/32

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: match_list_match: wx-out-0506.google.com: no match

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: match_list_match: 11.249.81.229: no match

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: generic_checks: name=permit_mynetworks status=0

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: generic_checks: name=reject_unauth_destination

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: reject_unauth_destination: eje211@mydomain.co.uk

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: permit_auth_destination: eje211@mydomain.co.uk

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: ctable_locate: leave existing entry key eje211@mydomain.co.uk

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: NOQUEUE: reject: RCPT from wx-out-0506.google.com[11.249.81.229]: 554 <eje211@mydomain.co.uk>: Relay access denied; from=<me@gmail.com> to=<eje211@mydomain.co.uk> proto=ESMTP helo=<wx-out-0506.google.com>

May 31 04:42:19 frontofmind-pri postfix/smtpd[8622]: generic_checks: name=reject_unauth_destination status=2

--snip--
```

(What is this "no match" stuff, by the way?)

Thanks to anyone who can help

----------

## elgato319

You did not authenticate.

 *Quote:*   

> 
> 
> generic_checks: name=reject_unauth_destination status=2
> 
> 

 

In your config you have:

```

# Specify "mynetworks_style = host" when Postfix should "trust"

# only the local machine.

#

mynetworks_style = host

```

So postfix only trusts when sending mail from the machine locally, but not externally.

check: 

https://forums.gentoo.org/viewtopic-t-543208-highlight-smtp+auth.html

http://www.postfix.org/SASL_README.html

http://www.nervous.it/txt/Postfix-SMTP-AUTH-4-DUMMIES.html

----------

## eje211

I've looked at those links, but how do they apply? I'm not trying to use postfix (in this instance) to relay mail but to receive it at my final destination. This is what a telnet session says:

```
$ telnet mail.mydomain.co.uk 25

Trying 21.11.193.91...

Connected to mail.mydomain.co.uk.

Escape character is '^]'.

220 mail.mydomain.co.uk ESMTP Postfix

MAIL FROM:<eje211@myemail.com>

250 Ok

rcpt to:<eje211@mydomain.co.uk>

554 <eje211@hostrestaurant.co.uk>: Relay access denied

quit

221 Bye

Connection closed by foreign host.
```

The authentication would be if I'm trying to send from an email client like Thunderbird or Kmail to somewhere else using postfix as my smtp server, right?

----------

## elgato319

Ok,

if i understand you correctly, then the mailserver doesn't know that he is responsible for mydomain.co.uk.

Could you try to add this to your main.cf, restart postfix and try again via telnet?

```

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

```

----------

## eje211

I worked. I love you. (I must have spent about 20 hours on this.)

----------

## elgato319

grats  :Smile: 

----------

