Send email with Postfix in Ubuntu

As you know, to install a email server, you should install both Postfix and Dovecot, in this case it is quite complicated.  In case you just need run sendmail function of Postfix, you should install PostFfix and config to relay to a SMTP server that you have.  So in this article, I will show you steps to install and config it.

The scenario of this example as below:

You have a smtp server with configuration information as below

Firstly, install Postfix:

Open /etc/postfix/ change some parameters as below:

And create /etc/postfix/sasl_passwd file and add content below

Type below comand to create sasl_passwd.db:

Restart Postfix:

Finally, test send email (make sure that you installed mail client):

You are done.

In case having errors, you can check log with command:

And now,  you can write a php script, use Swiftmailer library to test send email via transport sendmail