Set up mail for the domain through Yandex. If you send mail to info@romabox.ru from any external mailbox (yandex, gmail), then everything comes normally to your Yandex account, but if you send mail using a script on the server, then it comes to the local mailbox (which was created earlier with by the same name).

If in Yandex you make a new box with a different name and try to send mail to it from the server, then in the logs we get the following:

Jul 6 14:20:18 localhost postfix/pickup[4660]: A977321E84: uid=0 from=<root@localhost> Jul 6 14:20:18 localhost postfix/cleanup[5221]: A977321E84: message-id=<20180706112018.A977321E84@mail.romabox.ru> Jul 6 14:20:18 localhost opendkim[2232]: A977321E84: no signing table match for 'root@localhost.romabox.ru' Jul 6 14:20:18 localhost postfix/qmgr[26745]: A977321E84: from=<root@localhost.romabox.ru>, size=399, nrcpt=1 (queue active) Jul 6 14:20:18 localhost postfix/local[5223]: A977321E84: to=<hello@romabox.ru>, relay=local, delay=0.05, delays=0.04/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "hello") Jul 6 14:20:18 localhost postfix/cleanup[5221]: B2FF721E85: message-id=<20180706112018.B2FF721E85@mail.romabox.ru> Jul 6 14:20:18 localhost postfix/qmgr[26745]: B2FF721E85: from=<>, size=2173, nrcpt=1 (queue active) Jul 6 14:20:18 localhost postfix/bounce[5224]: A977321E84: sender non-delivery notification: B2FF721E85 Jul 6 14:20:18 localhost postfix/qmgr[26745]: A977321E84: removed Jul 6 14:20:18 localhost postfix/smtp[5226]: B2FF721E85: to=<root@localhost.romabox.ru>, relay=none, delay=0.06, delays=0.01/0.01/0.04/0, dsn=5.4.4, status=bounced (Host or domain name not Jul 6 14:20:18 localhost postfix/qmgr[26745]: B2FF721E85: removed 

Postfix is ​​responsible for sending letters, how to configure it so that it sends letters to Yandex?

The /etc/postfix/main.cf now has the following:

 myhostname = mail.romabox.ru myorigin = /etc/mailname mydestination = mail.romabox.ru, romabox.ru, localhost, localhost.localdomain 
  • one
    Judging by the logs, your postfix thinks that the domain romabox.ru local, and tries to deliver mail to a local user hello , who does not find (unknown user: "hello") . It is necessary to “explain” to the postfix that the domain romabox.ru not his (see the directive myhostname , mydomain , myorigin in main.cf ), so that he eventually sent here: mx.yandex.net - de_frag
  • @de_frag and what exactly should be registered there? - Dmitry Maslennikov
  • there are now such values: myhostname = mail.romabox.ru myorigin = / etc / mailname mydestination = mail.romabox.ru, romabox.ru, localhost, localhost.localdomain - Dmitry Maslennikov
  • one
    let's remove romabox.ru for the start from romabox.ru . Restart postfix and try sending again. - de_frag
  • @de_frag thanks for the right direction of the search, the problem was solved when I pointed out: mydestination = mx.yandex.net, localhost - Dmitry Maslennikov

1 answer 1

Sending began to work correctly when in /etc/postfix/main.cf indicated the following value in the field mydestination:

 mydestination = mx.yandex.net, localhost