I decided to set up postfix on my server, the main task is to send letters from mail() php , through an account in Yandex traffic policy (“mail for domains”).

I did everything according to these instructions: http://onedev.net/post/277

everything seems pretty simple, but nothing works for me, in the end it’s not at all clear what happened, here is the log /var/log/mail.log :

 Jun 28 23:16:23 server postfix/pickup[9768]: A7FB7630E1: uid=1000 from=<sanu> Jun 28 23:16:23 server postfix/cleanup[12565]: A7FB7630E1: message-id=<20150628201623.A7FB7630E1@server.localdomain> Jun 28 23:16:23 server postfix/qmgr[9769]: A7FB7630E1: from=<sanu@server.localdomain>, size=530, nrcpt=1 (queue active) Jun 28 23:16:23 server postfix/local[12710]: warning: database /etc/aliases.db is older than source file /etc/aliases Jun 28 23:16:23 server postfix/local[12710]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Jun 28 23:16:23 server postfix/local[12710]: A7FB7630E1: to=<root@server.localdomain>, orig_to=<root>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox) Jun 28 23:16:23 server postfix/qmgr[9769]: A7FB7630E1: removed 

In general, I do not understand what's what. Earlier it was simpler, there was a win server , in which everything was simply banal in sendmail.ini .

Maybe postfix is not the best option? tell me what to choose in this case? Or is there any more chewed up instruction for noobs on how to set up postfix in the case of Yandex PDD ?

ps In my case, the letter does not come anywhere, and in php mail() returns true

  • 1. the letter arrived safely: the penultimate line notifies that it has been delivered to the mailbox of the user root@server.localdomain . 2. Tell me, why do you need the letters to leave in a "round" way, through Yandex servers? do you have an external ip constantly changing? - aleksandr barakin
  • no, ip is static, but due to the fact that there is no way to make a normal PTR - letters fly to spam, and through Yandex - norms - sanu0074

1 answer 1

sending mail to Yandex servers only makes sense if your mail server does not have a fixed external IP address. if this is the case (or is required for some non-technical reasons), here is the instruction:

in the case of ubuntu, I would recommend using exim instead of postfix : in my opinion, it is somewhat easier to configure for typical use cases.

  • install the package: sudo apt-get install exim4 .
  • In the /etc/exim4/passwd.client file /etc/exim4/passwd.client add a line (with the current account and password data under which you need to authenticate with Yandex):

     smtp.yandex.ru:user@domain.ru:пароль 
  • if the installation did not offer customization, then after installation, start it with the command sudo dpkg-reconfigure exim4-config . further it will be about what to enter in the settings dialogs (with explanations in brackets):

  1. “Mail sent by smarthost; no local mail "(select this item from the list)
  2. "Some-server.domain.ru" (if the domain on Yandex is registered as domain.ru )
  3. "127.0.0.1" (IP-addresses to listen on for incoming SMTP connections - at what address to receive mail)
  4. “” (Other destinations for which mail is accepted is to leave empty by deleting what can be substituted there)
  5. "Domain.ru" (Visible domain name for local users)
  6. "Smtp.yandex.ru Down87" (smarthost)
  7. “Yes” (Keep number of DNS-queries minimal)
  8. “Yes” (Split configuration into small files)

in fact, everything.


You can immediately and test. one of the ways (depending on which program is installed as mail ). either way (from user1@domain.ru to user2@domain.ru ):

 $ echo body | mail -r user1@domain.ru -s subject user2@domain.ru 

either so:

 $ echo body | mail -a "From: user1@domain.ru" -s subject user2@domain.ru