when a user sends an email.. what is the procedures that is happening? i mean how the servers is distinguishing between @gmail.com and http://gmail.com for example? are there special configuration has to be done in the DNS server?
Using gmail.com as an example:
The MX record preference determines the server which will be tried first in order of lowest number to highest. So in this case mail servers will attempt to deliver mail to gmail-smtp-in.l.google.com before trying alt1.gmail-smtp-in.l.google.com etc.
If MX preference numbers are the same then the mail servers should randomly distribute mail between them.
With respect to mail it self the protocol used is Simple Mail Transfer Protocol or SMTP.