Configure Postfix to Use Gmail SMTP on Ubuntu : <p>I'm using <a href="https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/" rel="noreferrer">this online guide here</a> to enable
simple mail sending from linux (ubuntu) terminal
with postfix through some gmail account.
I've done the steps listed there:</p>

<pre><code>sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules
vim /etc/postfix/main.cf
</code></pre>

<p>And add these lines:</p>

<pre><code>relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
</code></pre>

<p>Then edit this file:</p>

<pre><code>vim /etc/postfix/sasl_passwd
</code></pre>

<p>To add the lines like it says in the guide:</p>

<pre><code>[smtp.gmail.com]:587    USERNAME@gmail.com:PASSWORD
</code></pre>

<p>(Of course with my own mail and password) then finally:</p>

<pre><code>sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
</code></pre>

<p>And then:</p>

<pre><code>sudo /etc/init.d/postfix reload
</code></pre>

<p>When I try to send a simple mail nothing happens:</p>

<pre><code>echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com
</code></pre>

<p>(Of course here too with some other valid email)</p>

<p>What am I doing wrong? Thanks!</p>
