postfic-mailx email solution in Linux/Ubuntu


Using mail function from postfic-mailx solution in Ubuntu is simple.
In the terminal, you can just use it like this when the body  message is in a file:
mail -s 'Error Report' username@company.com < /tmp/message.txt

And when body message is simple message, you can use:
a="message"
echo $a | mail -s 'subject' username@company.com


The installation and configuration process is as follows:

Install process:
sudo apt-get install postfix
Configuration process:
sudo dpkg-reconfigure postfix
then need select options as below for the configuration: 
detail guideline here:

And if postfix is already installed by other installation in the system, then it may be lack of /etc/postfix/main.cf config file, then you still need to run cmd below to complete the configuration for email (you can also manually add the config file, but seems still need to run the cmd below to select the 1st option: internet Site ) :
sudo dpkg-reconfigure postfix
and select the options as listed above.

After the configuration, you may need to reload the config by using:
sudo /etc/init.d/postfix reload
Or the reload may be auto started after the configuration by itself. 

Comments

Popular posts from this blog

install postgreSQL in ubuntu 16.04

timestamp with 16, 13 and 10 digits to Qlik date

install ipython in Cloudera VM using pip