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
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:
- Internet Site
- steve
- mail.example.com, localhost.localdomain, localhost
- No
- 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24
- 0
- +
- all
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
Post a Comment