Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Debian server with postfix configured with sasl and tls, and dovecot as a mail server. I'm having two separate problems sending mail to my account on the server.

First, when I send mail from my gmail account, I get

Jan  4 23:35:50 avalon postfix/smtpd[2599]: NOQUEUE: reject: RCPT from mail-pb0-f43.google.com[209.85.160.43]: 554 5.7.1 <a@b.com>: Relay access denied; from=<a@gmail.com> to=<a@b.com> proto=ESMTP helo=<mail-pb0-f43.google.com>

Doing some research, it seems like the problem is the following two lines

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

I'm a newbie, but from what I've garnered, postfix is serving as a relay server relaying mail from another MTA to dovecot, and only mynetworks are allowed to send relay requests. Is this correct? If so, how would I fix this? I would like anyone to be able to send email to this server, but would also like to prevent abuse (e.g., spam).

The second problem is when I try to send email to myself, I get

Jan  4 23:53:22 avalon postfix/smtp[2679]: 227D638C7857: to=<a@b.com>, relay=none, delay=0.32, delays=0.09/0/0.23/0, dsn=5.4.6, status=bounced (mail for b.com loops back to myself)

What exactly is the problem here and how can I fix it?

share|improve this question

1 Answer 1

I think I've got it figured out. Adding permit_auth_destination to smtpd_recipient_restrictions and with the right mydestination allowed mail sent to the server to not bounce. However, mail was sent to /var/mail/ instead of dovecot. My mailbox_command was procmail, so I made a new file /etc/procmailrc with the following, as I have dovecot configured to use Maildir format.

DEFAULT="$HOME/Maildir/"
MAILDIR="$HOME/Maildir/"

This second half seems to have fixed the "mail loops back to myself" problems, presumably because procmail is not trying to use the default sendmail anymore.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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