what The best and shortest way to send email using the PHP language

I have a problem sending an email message from the server to a gmail email. I have tried all the methods (phpmailer, mail function),I also changed the settings of php.ini and sendmail.ini more than once… and despite that, errors appeared. I tried to find solutions, but to no avail. I have a project and I am supposed to send it at the specified time, but I have no help… Is there anyone of you who has solved what I mean to help me, because for 3 months I have been trying, but there is no solution for this, so I hope for your help… Thank you.

The language used in the system is php