2

I have a Digital Ocean VPS, at which I installed postfix. I want to do mail forwarding.

When I installed postfix I picked No configuration option. Later I set up the following:

I created main.cf at /etc/postfix

virtual_alias_domains = gintegraconstruccion.com
virtual_alias_maps = hash:/etc/postfix/virtual

Created virtual

contacto@gintegraconstruccion.com mypersonalmail@gmail.com

I restarted postfix then.

At my DNS configuration (I got godaddy) I did:

Created an A record:

Host        Points to
contacto    107.XX.XX.XX

Created a MX record:

Host        Points to
@           contacto.gintegraconstruccion.com

However I tried it and got any mail at my gmail inbox.

The output of dig gintegraconstruccion.com is:

; <<>> DiG 9.8.1-P1 <<>> gintegraconstruccion.com mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34297
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;gintegraconstruccion.com.  IN  MX

;; ANSWER SECTION:
gintegraconstruccion.com. 599   IN  MX  0 contacto.gintegraconstruccion.com.

;; Query time: 93 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Wed May 14 13:01:53 2014
;; MSG SIZE  rcvd: 67

Just for the record, I'm currently hosting site with Openshift as I've not migrated it.

Cheking at /etc/log/mail.log I found:

May 14 11:52:51 localhost postfix/postfix-script[24478]: fatal: the Postfix mail system is not running
May 14 12:02:05 localhost postfix/postfix-script[24600]: fatal: the Postfix mail system is not running
May 14 12:02:27 localhost postfix/master[24724]: daemon started -- version 2.9.6, configuration /etc/postfix
May 14 12:02:31 localhost postfix/master[24724]: reload -- version 2.9.6, configuration /etc/postfix
May 14 13:06:07 localhost postfix/smtpd[24865]: error: open database /etc/aliases.db: No such file or directory
May 14 13:06:07 localhost postfix/smtpd[24865]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 14 13:06:07 localhost postfix/smtpd[24865]: connect from f.qw.se[109.74.194.71]
May 14 13:06:13 localhost postfix/smtpd[24865]: disconnect from f.qw.se[109.74.194.71]
May 14 13:06:44 localhost postfix/smtpd[24865]: connect from f.qw.se[109.74.194.71]
May 14 13:07:07 localhost postfix/smtpd[24865]: 5F052432EF: client=f.qw.se[109.74.194.71]
May 14 13:07:15 localhost postfix/smtpd[24865]: disconnect from f.qw.se[109.74.194.71]
May 14 13:10:36 localhost postfix/anvil[24867]: statistics: max connection rate 2/60s for (smtp:109.74.194.71) at May 14 13:06:44
May 14 13:10:36 localhost postfix/anvil[24867]: statistics: max connection count 1 for (smtp:109.74.194.71) at May 14 13:06:07
May 14 13:10:36 localhost postfix/anvil[24867]: statistics: max cache size 1 at May 14 13:06:07
May 14 13:14:20 localhost postfix/master[24724]: reload -- version 2.9.6, configuration /etc/postfix
May 14 13:18:29 localhost postfix/master[24724]: reload -- version 2.9.6, configuration /etc/postfix
May 14 13:21:04 localhost postfix/smtpd[24982]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 14 13:21:04 localhost postfix/smtpd[24982]: connect from mail-wi0-f175.google.com[209.85.212.175]
May 14 13:21:05 localhost postfix/smtpd[24982]: 1BC40432EF: client=mail-wi0-f175.google.com[209.85.212.175]
May 14 13:21:05 localhost postfix/cleanup[24987]: 1BC40432EF: message-id=<CA+z_Byat_HTi2WxSuvtis5OOk-pbYcqehT-Ntj6Xvra=kxD_6g@mail.gmai$
May 14 13:21:05 localhost postfix/qmgr[24976]: 1BC40432EF: from=<diegoaguilaraguilar@gmail.com>, size=2670, nrcpt=1 (queue active)
May 14 13:21:05 localhost postfix/smtpd[24982]: disconnect from mail-wi0-f175.google.com[209.85.212.175]
May 14 13:21:05 localhost postfix/smtp[24988]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c01::1a]:25: Network is unreachable
May 14 13:21:06 localhost postfix/smtp[24988]: 1BC40432EF: to=<diegoaguilaraguilar@gmail.com>, orig_to=<contacto@gintegraconstruccion.c$
May 14 13:21:06 localhost postfix/qmgr[24976]: 1BC40432EF: removed

Last lines of log (after mail sent from a hotmail worked):

May 14 13:52:19 localhost postfix/smtpd[25133]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 14 13:52:19 localhost postfix/smtpd[25133]: connect from col0-omc1-s18.col0.hotmail.com[65.55.34.28]
May 14 13:52:20 localhost postfix/smtpd[25133]: 22ED0432EF: client=col0-omc1-s18.col0.hotmail.com[65.55.34.28]
May 14 13:52:20 localhost postfix/cleanup[25137]: 22ED0432EF: message-id=<COL129-W83EFDE2F958513C56F1FEC8F370@phx.gbl>
May 14 13:52:20 localhost postfix/qmgr[25091]: 22ED0432EF: from=<piah.garci@hotmail.com>, size=1528, nrcpt=1 (queue active)
May 14 13:52:20 localhost postfix/smtpd[25133]: disconnect from col0-omc1-s18.col0.hotmail.com[65.55.34.28]
May 14 13:52:22 localhost postfix/smtp[25138]: 22ED0432EF: to=<cesarleonardoor@icloud.com>, orig_to=<contacto@gintegraconstruccion.com>$
May 14 13:52:22 localhost postfix/qmgr[25091]: 22ED0432EF: removed
diegoaguilar
  • 159
  • 1
  • 3
  • 10

1 Answers1

2

Because your virtual maps are the hash type (as specified by the hash: in the config line) after creating the virtual file you need to create the map by running postmap /etc/postfix/virtual.

Judging by the errors in the logs, you also need to run postalias /etc/aliases because it's complaining that there is no aliases.db file.

There's a typo in your virtual_alias_domains config line. The first letter of the domain is a Q rather than a G.

virtual_alias_domains = qintegraconstruccion.com

If that exists in your actual config file and isn't just a typo in the question here, it needs fixing too.

Lastly, there appears to be one successful forwarded email in that log sample you provided. Message 1BC40432EF was successfully sent to Google. Google may well have discarded the email after accepting it but they did accept it.


General deliverablity will be important for you. Since you are not running Google Apps for Business, you have no way of whitelisting your IP address from within Google. So you will have to conform to all the normal best practices. If you get it all correct, Gmail should not reject your mail.

  • You don't currently have a reverse lookup on your IP address. You will have to ask DigitalOcean for this. It should be the same as the myhostname directive in your postfix config. I would recommend using contacto.gintegraconstruccion.com since it already points to the correct IP address.
  • You are not currently on SpamHaus's PBL. This is good, but lucky. Amazon EC2 addresses are on the PBL unless you ask Amazon to remove yours. Cloud providers (and residential providers) are likely to be on the PBL because their policy is that you should not be sending mail from that IP address.
  • You have no SPF record.
  • It's unlikely that you have a DKIM record.
  • You have no DMARC record. This one will help with understanding why some providers are rejecting your mail. If you configure your SPF or DKIM records incorrectly, the DMARC reports will let you know.
  • The From: address is an @gmail.com address. I don't know what your envelope-from address would look like but if it's also gmail.com then any host that supports SPF will reject your mail because your IP address is not in Gmail's SPF record. The envelope-from address is set by the smtp_helo_name line in your postfix config.
Ladadadada
  • 25,847
  • 7
  • 57
  • 90
  • It was a typo in the question, at the file I got it correct, with g. I did run `postmap` but didn't run `postalias`. I tried with a hotmail mail and it mailed instantly an *older* mail after `postmap` and reloading, but not consequent sent mails. I changed the forwarding mail to an ***@icloud*** and it's not sending anything, not even in logs ... Thanks in advance – diegoaguilar May 14 '14 at 17:48
  • Well I sent from a hotmail account and it was forwarded instantly. I will update now my post with some information about a mail which seems to be on queue. Thanks – diegoaguilar May 14 '14 at 17:58
  • Can you extend a lil bit more about the points you marked I should follow? I'm a newbie about mailing and servers administration. – diegoaguilar May 14 '14 at 18:02
  • One question, even if i use an external email server like sendgrind, do the spam filters still probe for the domain and find that domain is not the same as the sending one, wont that cause troubles? – Miguel Feb 06 '17 at 16:20