PHP function mail() doesn't work on AWS EC2 server
<p>Recently I installed an AWS EC2 virtual server based on <strong>Ubuntu 14.04</strong>. But I have the next problem: <strong>the PHP function mail() doesn't work</strong>.</p>

<hr>

<ol>
<li>I removed sendmail.</li>
<li><p>I installed sendmail:</p>

<p><strong>sudo apt-get install sendmail</strong></p></li>
<li><p>I check its working:</p>

<p><strong>ps -aux | grep sendmail</strong></p></li>
<li><p>I changed php.ini:</p>

<p><strong>sendmail_path =  /usr/sbin/sendmail</strong></p></li>
<li><p>I run:</p>

<p><strong>sudo sendmailconfig</strong></p></li>
</ol>

<p>Selected <strong>Yes</strong> for all categories.</p>

<ol start="6">
<li><p>Restarted the service:</p>

<p><strong>service sendmail restart</strong></p></li>
<li><p>Added my <strong>hostname</strong> to /etc/hosts:</p>

<p><strong>127.0.0.1 localhost.localdomain localhost myhostname</strong></p></li>
<li><p>I tried to test sending:</p>

<p><strong>echo -e "To: myemail@example.com\nSubject: Test\nTest\n" | sendmail -bm -t -v</strong></p></li>
</ol>

<p><a href="https://i.stack.imgur.com/8LROo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8LROo.jpg" alt="enter image description here"></a></p>

<p><strong>All emails stored in /var/mail/ubuntu.</strong></p>

<hr>

<p><strong>Shall I do any additional things?</strong></p>