Plese, explain me, how two smtp servers communicate betwen each. When i write e-mail and send it to other user, my client communicate with my smtp server by smtp protocol with ehlo/mail from/ rcpt to/ and etc... When this mail get my smtp server from client what happens next? How my smtp server send mail to other smtp server?
Thank you.
SMTP servers also use the SMTP protocol to talk to each other.
Briefly (very briefly) the sending server looks at an address, uses DNS to look up the domain name and find the address of the mail servers at that domain (these are stored as "MX" records in the domain).
The sending server then uses SMTP to contact the mail server at the target domain to send your email, which is done using the exact same procedure as the client used to submit the message in the first place.
You may find this article useful.
http://www.faqs.org/rfcs/rfc2821.html