I know that to send e-mail from localhost on Windows, you need to change SMTP server in php.ini however this is valid only on Windows:
[mail function]
; For
Setup sendmail or exim. Search in your package manager for either of the option and install them. Senmail is common and setting it up should do the job. The mail command on linux is an MUA or mail user agent, a Mail User Agent (MUA) is an application that is used to send and receive email, more of a client. Whereas mail transfer agent transfers emails from one computer to another using a client–server application architecture.