hello every one,
I am new in email server configurations and i know some basic concepts, and i have some questions to ask

.
i have installed LimeSurvey and it is working well, i have started reading the Manual for the administration of LimeSurvey. i read a part about Email Setting (in global settings) for the email configuration and i consulted some links in the web but i have a confusion.
I would like to ask i what i understood is correct:
There is two different solutions:
1)The first is to use SMTP relaying with a distant email server that exists(gmail, hotmail, outlook...), so in order to use my gmail account for example i can just type the address and give the different fields (password,...) and that's it? so LimeSurvey wil be able to manage sending and receiving with this email account?
2) The second thing is that if i would like to create my own email server, i can install sendmail (or Qmail) and configure it, and i can specify my domain(lets consider it is @suivipatients.com). i am working with a virtual machine on local but i don't see when trying to send emails to other accounts like (gmail) how it will be able to be sent, i mean how to verify that i am the only one who owns this domain because if so (i can make it @outlook.com ... which is i think not legal and not possible).
If i configured the email server, do i have to just select "Sendmail" in email settings? and it will get the access to the mail server configured in the same running machine? because when i select it there is no other field to add (like password or other).
What is php ? and is it related to the imap package required for the installation at the beginning ?