# Postfix+Dovecot



## Zack (Aug 4, 2015)

Having a bit of trouble with Postfix/Dovecot. I am able to receive email, but I am having trouble sending email. Using /usr/ports/mail/dovecot2 and /usr/ports/mail/postfix. Here is /var/log/maillog after trying to send a message:

```
Aug  4 17:25:46 punkweb postfix[695]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:25:46 punkweb postfix/master[700]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:25:46 punkweb postfix/postsuper[728]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:25:47 punkweb postfix/postlog[764]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:25:47 punkweb postfix/postfix-script[764]: starting the Postfix mail system
Aug  4 17:25:47 punkweb postfix/master[766]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:25:47 punkweb postfix/master[766]: daemon started -- version 2.11.6, configuration /usr/local/etc/postfix
Aug  4 17:25:47 punkweb postfix/pickup[768]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:25:47 punkweb postfix/qmgr[769]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:28:02 punkweb sendmail[1442]: t74LS2l2001442: from=<root@punkweb.co>, size=316, class=0, nrcpts=1, msgid=<alpine.BSF.2.20.1508041727520.1441@punkweb.co>, proto=ESMTP, relay=root@localhost
Aug  4 17:28:02 punkweb postfix/smtpd[1445]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:28:02 punkweb postfix/proxymap[1446]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:28:02 punkweb postfix/smtpd[1445]: connect from punkweb[127.0.0.1]
Aug  4 17:28:02 punkweb postfix/anvil[1447]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:28:03 punkweb postfix/trivial-rewrite[1448]: warning: /usr/local/etc/postfix/main.cf, line 28: overriding earlier entry: mynetworks_style=host
Aug  4 17:28:03 punkweb postfix/smtpd[1445]: NOQUEUE: reject: RCPT from punkweb[127.0.0.1]: 454 4.7.1 <nothankyou273@yahoo.com>: Relay access denied; from=<root@punkweb.co> to=<nothankyou273@yahoo.com> proto=ESMTP helo=<punkweb.co>
Aug  4 17:28:03 punkweb sendmail[1444]: t74LS2l2001442: to=<nothankyou273@yahoo.com>, ctladdr=<root@punkweb.co> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30316, relay=[127.0.0.1] [127.0.0.1], dsn=4.7.1, stat=Deferred: 454 4.7.1 <nothankyou273@yahoo.com>: Relay access denied
Aug  4 17:28:03 punkweb postfix/smtpd[1445]: disconnect from punkweb[127.0.0.1]
```

/usr/local/etc/postfix/main.cf

```
queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
mynetworks_style = host

debug_peer_level = 2

debugger_command =
  PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
  xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/local/sbin/sendmail
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = no
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix
readme_directory = no

mydomain = punkweb.co
myhostname = punkweb
myorigin = $myhostname
mydestination = $myhostname, localhost,$mydomain

mynetworks = 192.168.2.0/24
mynetworks_style = subnet
```


/usr/local/etc/dovecot.conf

```
protocols = imap pop3
disable_plaintext_auth = no

mail_location = mbox:~/mail/:INBOX=/var/mail/%u
mail_privileged_group = mail
verbose_proctitle = yes
first_valid_gid = 0

protocol imap {
  imap_client_workarounds = delay-newmail outlook-idle netscape-eoh tb-extra-mailbox-sep
}

protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}

protocol lda {
  postmaster_address = web@punkweb.co
  sendmail_path = /usr/sbin/sendmail
}

auth default {
  mechanisms = plain

  passdb pam {
  }

  userdb passwd {
  }

  user = root
}
dict {
  #quota = mysql:/usr/local/etc/dovecot-dict-quota.conf
}

plugin {
}
ssl = required
ssl_cert= /etc/ssl/cert/dovecot.pem
ssl_key= /etc/ssl/private/dovecot.pem
```

P.S - This is going to be for my own personal use. More or less as a learning experience, but to also use as a personal email. (though that shouldn't really matter)
Since this is my first time setting up a mail server, I followed these instructions just to see it get working:
http://www.freebsdonline.com/content/view/571/506/

EDIT: by taking out the mynetworks= options, I was able to send email from my server to a gmail account. Now to work around not being seen as spam...

Now that I am able to send emails as well as receive them, I am having another issue! I thought this existing thread would be the best place to ask...

I am getting the following error in /var/log/maillog

```
Service unavailable; Client host [66.67.1.157] blocked using zen.spamhaus.org; http://www.spamhaus.org/query/bl?ip=**.**.*.*** (in reply to RCPT TO command))
```
http://www.spamhaus.org/faq/section/Spamhaus PBL#183
States: "PBL listings *do not* prevent you sending email *unless* your email program is not authenticating properly when it connects to your ISP or to your company's mail server. This can happen if you have forgotten to turn on 'SMTP Authentication' or if you have switched 'SMTP Authentication' off by mistake. "
Is this just an issue with SMTP authentication on my side? If I can get around this without using my ISP's mail server that would be the most desired way.


----------

