Using Postfix

It is easy to forget how to test Postfix from the command line as it is usually a dependency of another program that leverages it in the background and the command line is not used for any practical purposes in our day to day activities. Sometimes it’s necessary to test from the command line for various reasons beyond the scope of this article. That said, I’ve documented a couple of very basic practical examples of how it can be used.

Example 1(one liner on command line):
    echo "Subject: Test Email" | sendmail

Example 2(one liner but it involves file):
    sendmail -t < fileWithEmailInfo.txt

Contents of fileWithEmailInfo.txt
Subject: sendmail test two

And here goes the e-mail body, test test test..