Posted on

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 my@email.com

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

Contents of fileWithEmailInfo.txt
To: my@email.com
Subject: sendmail test two
From: me@myserver.com

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

 

References: