$ echo "foobar" | mail -s "testing" email@example.com The program 'mail' can be found in the following packages: * heirloom-mailx * mailutils Try: apt-get install
So, I was given two choices. Which one? I ended up picking GNU Mailutils because of dependency of Exim, which is known to be lightweight and easy to configure.
$ sudo -s $ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install mailutils exim4-daemon-light $ dpkg-reconfigure exim4-config
Exim mailer was configured using following settings.
- General type of mail configuration: internet site
- System mail name: foobar
- IP-addresses to listen on for incoming SMTP connections: 127.0.0.1 ; ::1
- Other destinations for which mail is accepted: foobar; localhost.localdomain; localhost
- Domains to relay mail for:
- Machines to relay mail for:
- Keep number of DNS-queries minimal (Dial-on-Demand) :
- Delivery method for local mail: mbox format in /var/mail
- Split configuration into smaller files: no
To check whether we've configure Exim correctly.
$ exim -bt firstname.lastname@example.org R: dnslookup for email@example.com firstname.lastname@example.org router = dnslookup, transport = remote_smtp host mailinator.net [18.104.22.168] MX=10
To send out a sample test email.
$ echo "foobar" | mail -s "testing" email@example.com $ sudo tail -f /var/log/exim4/mainlog
However, GNU Mailutils does not support neither Bind Carbon Copy (BCC) nor Carbon Copy (CC). Hence, we've to install the bsd-mailx package.
$ sudo install apt-get install bsd-mailx
To send a Carbon Copy (CC) email.
$ echo "testing cc email" | mail -s "testing email cc" -c firstname.lastname@example.org email@example.com
To send a test Blind Carbon Copy (BCC) email.
$ echo "testing bcc email" | mail -s "testing email bcc" -b firstname.lastname@example.org email@example.com