A good example of sending mail is here – https://forum.antichat.ru/printthread.php?t=44490
If you need a port to C + +, write to me.
P.S. Practice has shown that the service mail.ru better not to deal with. Half day caught cause loss of messages such as “mailbox does not exist”, while the same yandex sent no questions asked.