0

I re-installed a fresh clean Debian 8 on my VPS.

All is set up to default values.

dpkg -s exim4 and dpkg -s postfix says that exim is not installed, and that postfix is installed. This is confirmed by lsof -i :25 which shows a PID 478, then ps p 478 shows 478 ? Ss 0:00 /usr/lib/postfix/master. I haven't done apt-get install postfix, it seems that it has been installed by default.

I've already done a DNS MX record for example.com by my registrar, directing it my server.

I just sent an email from my Gmail to root@example.com.

  1. I still see No mail when doing $ mail.

  2. How to see if something has arrived to postfix?

  3. Is there a configuration to do on a fresh new Debian install to accept emails from internet?

  4. Should I create the mailbox root locally, to accept mail arriving from external mailers to root@example.com?


Here is the result of iptables (unmodified, default configuration):

root@blah:~# iptables -nvL
Chain INPUT (policy ACCEPT 77135 packets, 50M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 2 packets, 120 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 66416 packets, 11M bytes)
 pkts bytes target     prot opt in     out     source               destination

I see now in cat /var/log/mail.log this:

Nov 22 11:57:32 blah postfix/smtpd[10485]: connect from mail-ua0-f171.google.com[209.85.xxx.xxx]  
Nov 22 11:57:32 blah postfix/smtpd[10485]: NOQUEUE: reject: RCPT from mail-ua0-f171.google.com[209.85.xxx.xxx]: 454 4.7.1 <root@example.com>: Relay access denied; from=<user@gmail.com> to=<root@example.com> proto=ESMTP helo=<mail-ua0-f171.google.com>  
Nov 22 11:57:32 blah postfix/smtpd[10485]: disconnect from mail-ua0-f171.google.com[209.85.xxx.xxx]
  • @roaima I added this to the question. – Basj Nov 22 '17 at 19:14
  • @roaima some news (see edit2). – Basj Nov 22 '17 at 19:19
1

This line contains the useful information that you need

Nov 22 11:57:32 blah postfix/smtpd[10485]: NOQUEUE: reject: RCPT from  mail-ua0-f171.google.com[209.85.xxx.xxx]: 454 4.7.1 <root@example.com>: Relay access denied; from=<user@gmail.com> to=<root@example.com ...

What this is telling you is that your machine is refusing to relay a message from Google to root@example.com. Now, you know that your machine is example.com, but clearly your machine doesn't.

Solution: modify the local configuration to include example.com as a name for your local machine. There is an easy-to-read document available on the Postfix website (((BASIC_CONFIGURATION_README.html)[http://www.postfix.org/BASIC_CONFIGURATION_README.html#mydestination]) that explains how to set this up:

My own domain name

The mydomain parameter specifies the parent domain of $myhostname. By default, it is derived from $myhostname by stripping off the first part (unless the result would be a top-level domain).

Conversely, if you specify mydomain in main.cf, then Postfix will use its value to generate a fully-qualified default value for the myhostname parameter.

Examples (specify only one of the following):

/etc/postfix/main.cf:
    mydomain = local.domain
    mydomain = virtual.domain (virtual interface)

What domains to receive mail for

The mydestination parameter specifies what domains this machine will deliver locally, instead of forwarding to another machine. The default is to receive mail for the machine itself. See the VIRTUAL_README file for how to configure Postfix for hosted domains.

You can specify zero or more domain names, "/file/name" patterns and/or "type:table" lookup tables (such as hash:, btree:, nis:, ldap:, or mysql:), separated by whitespace and/or commas. A "/file/name" pattern is replaced by its contents; "type:table" requests that a table lookup is done and merely tests for existence: the lookup result is ignored.

IMPORTANT: If your machine is a mail server for its entire domain, you must list $mydomain as well.

Example 1: default setting.

/etc/postfix/main.cf:
    mydestination = $myhostname localhost.$mydomain localhost

Example 2: domain-wide mail server.

/etc/postfix/main.cf:
    mydestination = $myhostname localhost.$mydomain localhost $mydomain

Example 3: host with multiple DNS A records.

/etc/postfix/main.cf:
    mydestination = $myhostname localhost.$mydomain localhost 
        www.$mydomain ftp.$mydomain

Caution: in order to avoid mail delivery loops, you must list all hostnames of the machine, including $myhostname, and localhost.$mydomain.

So, this should be sufficient:

mydomain = example.com
...
mydestination = $myhostname localhost.$mydomain localhost $mydomain
  • Thanks! I added mydestination = .... mydomain.com and now the error has disappeared, thanks :) But I get this Nov 22 13:12:37 blah postfix/local[11526]: EEA343FC4: to=<root@mydomain.com>, relay=local, delay=2.8, delays=0.88/0.4/0/1.5, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION") Nov 22 13:12:37 blah postfix/qmgr[11501]: EEA343FC4: removed, and I still see nothing when doing $ mail. – Basj Nov 22 '17 at 20:18
  • I accepted your answer @roaima, I also added this: unix.stackexchange.com/a/406399/59989 – Basj Nov 22 '17 at 20:51
0

In addition to roaima's answer, this solved it:

  1. Add the domain name at the end of mydestination = <....>, mydomain.com in /etc/postfix/main.cf

  2. Comment out this line: #mailbox_command = procmail -a "$EXTENSION"

  3. Then send an email from Gmail to root@mydomain.com, wait a few seconds

  4. Do mail, you will see the new email :)

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.