How to configure sending emails from a VPS?

Good day!
Trying to transfer a site on 1C-Bitrix to VPS (Beget). Configuration: Ubuntu and Vesta CP. Experience with servers there. Faced with a problem: not getting emails with notifications.
1. He looked to the table b_event - there is displayed, that letter sent
2. I tried to send a test email using the mail () function; the Function returns true, the message is sent, but the letters in the mail no.
3. Connected via SSH - executed sudo php -r "mail('you_mail@mail.ru', 'Test, 'Test');" the letter came.
4. In mail logs there is no error (the path to the logs prescribed in php.ini)
In php.ini sendmail_path spelled out. In what side to dig, prompt?

PS Notice the mail() function works 1 time after reboot server edinazhdy letter is coming, then not coming.
April 7th 20 at 15:52
2 answers
April 7th 20 at 15:54
Solution
1. Make sure that sendmail_path is configured and working.
Here are some sample settings $domain_name, respectively your domain. For example website.com
[HOST=$domain_name]
sendmail_path = /usr/sbin/sendmail -t-i-f no-reply@$domain_name"

2. Make sure you configure php.ini for PHP that is used on the website.
Create a file with any name in the site root, for example myinfo.php and block code:
phpinfo();

File save and open the file in the browser: your_domain/myinfo.php
In the opened window locate the value of the sendmail_path parameter.

3. Check the logs of the mail server.
When sending emails, there are bound to be logs of departure:
For example tailом stand on the log and send the letter.
tail-f /var/log/exim/mail.log
April 7th 20 at 15:56

Find more questions by tags HostingMail serverUbuntuVesta