Good day comrades! Let's imagine that the mail server with the name pwon.pp.ua received a letter from the client user htaccess@pwon.pp.ua and is going to send this letter to the user arsh-andrej@mail.ru.
And immediately the question: how to exchange mail between servers, how to communicate for this server with each other?
I wrote code in PHP and even managed to talk a bit with the mail.ru mail server.
<?php header('Content-Type: text/html; charset=utf-8'); # $opensocket_0 = fsockopen('smtp.mail.ru', 25, $errorcode, $errortext); # if ($opensocket_0 !== false) { //echo 'Подключено'; echo fgets($opensocket_0, 10000)."<br />\n"; # fwrite($opensocket_0, 'HELO mail.pwon.pp.ua '."\n"); # echo fgets($opensocket_0, 10000)."<br />\n"; # fwrite($opensocket_0, 'MAIL FROM: <htaccess@pwon.pp.ua>'."\n"); # echo fgets($opensocket_0, 10000)."<br />\n"; # fwrite($opensocket_0, 'RCPT TO: <arsh-andrej@mail.ru>'."\n"); # echo fgets($opensocket_0, 10000)."<br />\n"; # } else { var_dump($opensocket_0); } ?>
And that's what I got in return:
220 smtp16.mail.ru ESMTP ready 250
smtp16.mail.ru 250 2.0.0 OK 550
not local sender over smtp
I don’t need to know how to send a message from the client to the server, I’m wondering how to send a letter from the server to the server.