Question: My site neither receives nor sends emails from mail.ru, yandex, gmail and other accounts. The script doesn’t work.
Answer: You have to indicate mailbox address that is on your domain, so that the script works properly: email@example.com. If the letters are sent from IP address that doesn’t belong to your domain (mail.ru or yandex.ru for example), most mail systems will consider your letters spam and block them. To receive letters from third-party services, it is necessary to set up redirect from firstname.lastname@example.org to the appropriate email address.
The script algorithm must be as follows: after receiving of a request, authorization of your domain on mail server proceeds with login and password to the account (e.g. admin) and mail is sent on his behalf. If you try to send mail from the domain that is not in this account or if the domain is not authorised, then mail won’t be sent.